
obj/user/faultregs.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 b8 05 00 00       	call   8005e9 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <check_regs>:
static struct regs before, during, after;

static void
check_regs(struct regs* a, const char *an, struct regs* b, const char *bn,
	   const char *testname)
{
  800033:	55                   	push   %ebp
  800034:	89 e5                	mov    %esp,%ebp
  800036:	57                   	push   %edi
  800037:	56                   	push   %esi
  800038:	53                   	push   %ebx
  800039:	83 ec 0c             	sub    $0xc,%esp
  80003c:	89 c6                	mov    %eax,%esi
  80003e:	89 cb                	mov    %ecx,%ebx
	int mismatch = 0;

	cprintf("%-6s %-8s %-8s\n", "", an, bn);
  800040:	ff 75 08             	pushl  0x8(%ebp)
  800043:	52                   	push   %edx
  800044:	68 51 25 80 00       	push   $0x802551
  800049:	68 20 25 80 00       	push   $0x802520
  80004e:	e8 ef 06 00 00       	call   800742 <cprintf>
			cprintf("MISMATCH\n");				\
			mismatch = 1;					\
		}							\
	} while (0)

	CHECK(edi, regs.reg_edi);
  800053:	ff 33                	pushl  (%ebx)
  800055:	ff 36                	pushl  (%esi)
  800057:	68 30 25 80 00       	push   $0x802530
  80005c:	68 34 25 80 00       	push   $0x802534
  800061:	e8 dc 06 00 00       	call   800742 <cprintf>
  800066:	83 c4 20             	add    $0x20,%esp
  800069:	8b 03                	mov    (%ebx),%eax
  80006b:	39 06                	cmp    %eax,(%esi)
  80006d:	0f 84 2e 02 00 00    	je     8002a1 <check_regs+0x26e>
  800073:	83 ec 0c             	sub    $0xc,%esp
  800076:	68 48 25 80 00       	push   $0x802548
  80007b:	e8 c2 06 00 00       	call   800742 <cprintf>
  800080:	83 c4 10             	add    $0x10,%esp
  800083:	bf 01 00 00 00       	mov    $0x1,%edi
	CHECK(esi, regs.reg_esi);
  800088:	ff 73 04             	pushl  0x4(%ebx)
  80008b:	ff 76 04             	pushl  0x4(%esi)
  80008e:	68 52 25 80 00       	push   $0x802552
  800093:	68 34 25 80 00       	push   $0x802534
  800098:	e8 a5 06 00 00       	call   800742 <cprintf>
  80009d:	83 c4 10             	add    $0x10,%esp
  8000a0:	8b 43 04             	mov    0x4(%ebx),%eax
  8000a3:	39 46 04             	cmp    %eax,0x4(%esi)
  8000a6:	0f 84 0f 02 00 00    	je     8002bb <check_regs+0x288>
  8000ac:	83 ec 0c             	sub    $0xc,%esp
  8000af:	68 48 25 80 00       	push   $0x802548
  8000b4:	e8 89 06 00 00       	call   800742 <cprintf>
  8000b9:	83 c4 10             	add    $0x10,%esp
  8000bc:	bf 01 00 00 00       	mov    $0x1,%edi
	CHECK(ebp, regs.reg_ebp);
  8000c1:	ff 73 08             	pushl  0x8(%ebx)
  8000c4:	ff 76 08             	pushl  0x8(%esi)
  8000c7:	68 56 25 80 00       	push   $0x802556
  8000cc:	68 34 25 80 00       	push   $0x802534
  8000d1:	e8 6c 06 00 00       	call   800742 <cprintf>
  8000d6:	83 c4 10             	add    $0x10,%esp
  8000d9:	8b 43 08             	mov    0x8(%ebx),%eax
  8000dc:	39 46 08             	cmp    %eax,0x8(%esi)
  8000df:	0f 84 eb 01 00 00    	je     8002d0 <check_regs+0x29d>
  8000e5:	83 ec 0c             	sub    $0xc,%esp
  8000e8:	68 48 25 80 00       	push   $0x802548
  8000ed:	e8 50 06 00 00       	call   800742 <cprintf>
  8000f2:	83 c4 10             	add    $0x10,%esp
  8000f5:	bf 01 00 00 00       	mov    $0x1,%edi
	CHECK(ebx, regs.reg_ebx);
  8000fa:	ff 73 10             	pushl  0x10(%ebx)
  8000fd:	ff 76 10             	pushl  0x10(%esi)
  800100:	68 5a 25 80 00       	push   $0x80255a
  800105:	68 34 25 80 00       	push   $0x802534
  80010a:	e8 33 06 00 00       	call   800742 <cprintf>
  80010f:	83 c4 10             	add    $0x10,%esp
  800112:	8b 43 10             	mov    0x10(%ebx),%eax
  800115:	39 46 10             	cmp    %eax,0x10(%esi)
  800118:	0f 84 c7 01 00 00    	je     8002e5 <check_regs+0x2b2>
  80011e:	83 ec 0c             	sub    $0xc,%esp
  800121:	68 48 25 80 00       	push   $0x802548
  800126:	e8 17 06 00 00       	call   800742 <cprintf>
  80012b:	83 c4 10             	add    $0x10,%esp
  80012e:	bf 01 00 00 00       	mov    $0x1,%edi
	CHECK(edx, regs.reg_edx);
  800133:	ff 73 14             	pushl  0x14(%ebx)
  800136:	ff 76 14             	pushl  0x14(%esi)
  800139:	68 5e 25 80 00       	push   $0x80255e
  80013e:	68 34 25 80 00       	push   $0x802534
  800143:	e8 fa 05 00 00       	call   800742 <cprintf>
  800148:	83 c4 10             	add    $0x10,%esp
  80014b:	8b 43 14             	mov    0x14(%ebx),%eax
  80014e:	39 46 14             	cmp    %eax,0x14(%esi)
  800151:	0f 84 a3 01 00 00    	je     8002fa <check_regs+0x2c7>
  800157:	83 ec 0c             	sub    $0xc,%esp
  80015a:	68 48 25 80 00       	push   $0x802548
  80015f:	e8 de 05 00 00       	call   800742 <cprintf>
  800164:	83 c4 10             	add    $0x10,%esp
  800167:	bf 01 00 00 00       	mov    $0x1,%edi
	CHECK(ecx, regs.reg_ecx);
  80016c:	ff 73 18             	pushl  0x18(%ebx)
  80016f:	ff 76 18             	pushl  0x18(%esi)
  800172:	68 62 25 80 00       	push   $0x802562
  800177:	68 34 25 80 00       	push   $0x802534
  80017c:	e8 c1 05 00 00       	call   800742 <cprintf>
  800181:	83 c4 10             	add    $0x10,%esp
  800184:	8b 43 18             	mov    0x18(%ebx),%eax
  800187:	39 46 18             	cmp    %eax,0x18(%esi)
  80018a:	0f 84 7f 01 00 00    	je     80030f <check_regs+0x2dc>
  800190:	83 ec 0c             	sub    $0xc,%esp
  800193:	68 48 25 80 00       	push   $0x802548
  800198:	e8 a5 05 00 00       	call   800742 <cprintf>
  80019d:	83 c4 10             	add    $0x10,%esp
  8001a0:	bf 01 00 00 00       	mov    $0x1,%edi
	CHECK(eax, regs.reg_eax);
  8001a5:	ff 73 1c             	pushl  0x1c(%ebx)
  8001a8:	ff 76 1c             	pushl  0x1c(%esi)
  8001ab:	68 66 25 80 00       	push   $0x802566
  8001b0:	68 34 25 80 00       	push   $0x802534
  8001b5:	e8 88 05 00 00       	call   800742 <cprintf>
  8001ba:	83 c4 10             	add    $0x10,%esp
  8001bd:	8b 43 1c             	mov    0x1c(%ebx),%eax
  8001c0:	39 46 1c             	cmp    %eax,0x1c(%esi)
  8001c3:	0f 84 5b 01 00 00    	je     800324 <check_regs+0x2f1>
  8001c9:	83 ec 0c             	sub    $0xc,%esp
  8001cc:	68 48 25 80 00       	push   $0x802548
  8001d1:	e8 6c 05 00 00       	call   800742 <cprintf>
  8001d6:	83 c4 10             	add    $0x10,%esp
  8001d9:	bf 01 00 00 00       	mov    $0x1,%edi
	CHECK(eip, eip);
  8001de:	ff 73 20             	pushl  0x20(%ebx)
  8001e1:	ff 76 20             	pushl  0x20(%esi)
  8001e4:	68 6a 25 80 00       	push   $0x80256a
  8001e9:	68 34 25 80 00       	push   $0x802534
  8001ee:	e8 4f 05 00 00       	call   800742 <cprintf>
  8001f3:	83 c4 10             	add    $0x10,%esp
  8001f6:	8b 43 20             	mov    0x20(%ebx),%eax
  8001f9:	39 46 20             	cmp    %eax,0x20(%esi)
  8001fc:	0f 84 37 01 00 00    	je     800339 <check_regs+0x306>
  800202:	83 ec 0c             	sub    $0xc,%esp
  800205:	68 48 25 80 00       	push   $0x802548
  80020a:	e8 33 05 00 00       	call   800742 <cprintf>
  80020f:	83 c4 10             	add    $0x10,%esp
  800212:	bf 01 00 00 00       	mov    $0x1,%edi
	CHECK(eflags, eflags);
  800217:	ff 73 24             	pushl  0x24(%ebx)
  80021a:	ff 76 24             	pushl  0x24(%esi)
  80021d:	68 6e 25 80 00       	push   $0x80256e
  800222:	68 34 25 80 00       	push   $0x802534
  800227:	e8 16 05 00 00       	call   800742 <cprintf>
  80022c:	83 c4 10             	add    $0x10,%esp
  80022f:	8b 43 24             	mov    0x24(%ebx),%eax
  800232:	39 46 24             	cmp    %eax,0x24(%esi)
  800235:	0f 84 13 01 00 00    	je     80034e <check_regs+0x31b>
  80023b:	83 ec 0c             	sub    $0xc,%esp
  80023e:	68 48 25 80 00       	push   $0x802548
  800243:	e8 fa 04 00 00       	call   800742 <cprintf>
	CHECK(esp, esp);
  800248:	ff 73 28             	pushl  0x28(%ebx)
  80024b:	ff 76 28             	pushl  0x28(%esi)
  80024e:	68 75 25 80 00       	push   $0x802575
  800253:	68 34 25 80 00       	push   $0x802534
  800258:	e8 e5 04 00 00       	call   800742 <cprintf>
  80025d:	83 c4 20             	add    $0x20,%esp
  800260:	8b 43 28             	mov    0x28(%ebx),%eax
  800263:	39 46 28             	cmp    %eax,0x28(%esi)
  800266:	0f 84 53 01 00 00    	je     8003bf <check_regs+0x38c>
  80026c:	83 ec 0c             	sub    $0xc,%esp
  80026f:	68 48 25 80 00       	push   $0x802548
  800274:	e8 c9 04 00 00       	call   800742 <cprintf>

#undef CHECK

	cprintf("Registers %s ", testname);
  800279:	83 c4 08             	add    $0x8,%esp
  80027c:	ff 75 0c             	pushl  0xc(%ebp)
  80027f:	68 79 25 80 00       	push   $0x802579
  800284:	e8 b9 04 00 00       	call   800742 <cprintf>
  800289:	83 c4 10             	add    $0x10,%esp
	if (!mismatch)
		cprintf("OK\n");
	else
		cprintf("MISMATCH\n");
  80028c:	83 ec 0c             	sub    $0xc,%esp
  80028f:	68 48 25 80 00       	push   $0x802548
  800294:	e8 a9 04 00 00       	call   800742 <cprintf>
  800299:	83 c4 10             	add    $0x10,%esp
}
  80029c:	e9 16 01 00 00       	jmp    8003b7 <check_regs+0x384>
	CHECK(edi, regs.reg_edi);
  8002a1:	83 ec 0c             	sub    $0xc,%esp
  8002a4:	68 44 25 80 00       	push   $0x802544
  8002a9:	e8 94 04 00 00       	call   800742 <cprintf>
  8002ae:	83 c4 10             	add    $0x10,%esp
	int mismatch = 0;
  8002b1:	bf 00 00 00 00       	mov    $0x0,%edi
  8002b6:	e9 cd fd ff ff       	jmp    800088 <check_regs+0x55>
	CHECK(esi, regs.reg_esi);
  8002bb:	83 ec 0c             	sub    $0xc,%esp
  8002be:	68 44 25 80 00       	push   $0x802544
  8002c3:	e8 7a 04 00 00       	call   800742 <cprintf>
  8002c8:	83 c4 10             	add    $0x10,%esp
  8002cb:	e9 f1 fd ff ff       	jmp    8000c1 <check_regs+0x8e>
	CHECK(ebp, regs.reg_ebp);
  8002d0:	83 ec 0c             	sub    $0xc,%esp
  8002d3:	68 44 25 80 00       	push   $0x802544
  8002d8:	e8 65 04 00 00       	call   800742 <cprintf>
  8002dd:	83 c4 10             	add    $0x10,%esp
  8002e0:	e9 15 fe ff ff       	jmp    8000fa <check_regs+0xc7>
	CHECK(ebx, regs.reg_ebx);
  8002e5:	83 ec 0c             	sub    $0xc,%esp
  8002e8:	68 44 25 80 00       	push   $0x802544
  8002ed:	e8 50 04 00 00       	call   800742 <cprintf>
  8002f2:	83 c4 10             	add    $0x10,%esp
  8002f5:	e9 39 fe ff ff       	jmp    800133 <check_regs+0x100>
	CHECK(edx, regs.reg_edx);
  8002fa:	83 ec 0c             	sub    $0xc,%esp
  8002fd:	68 44 25 80 00       	push   $0x802544
  800302:	e8 3b 04 00 00       	call   800742 <cprintf>
  800307:	83 c4 10             	add    $0x10,%esp
  80030a:	e9 5d fe ff ff       	jmp    80016c <check_regs+0x139>
	CHECK(ecx, regs.reg_ecx);
  80030f:	83 ec 0c             	sub    $0xc,%esp
  800312:	68 44 25 80 00       	push   $0x802544
  800317:	e8 26 04 00 00       	call   800742 <cprintf>
  80031c:	83 c4 10             	add    $0x10,%esp
  80031f:	e9 81 fe ff ff       	jmp    8001a5 <check_regs+0x172>
	CHECK(eax, regs.reg_eax);
  800324:	83 ec 0c             	sub    $0xc,%esp
  800327:	68 44 25 80 00       	push   $0x802544
  80032c:	e8 11 04 00 00       	call   800742 <cprintf>
  800331:	83 c4 10             	add    $0x10,%esp
  800334:	e9 a5 fe ff ff       	jmp    8001de <check_regs+0x1ab>
	CHECK(eip, eip);
  800339:	83 ec 0c             	sub    $0xc,%esp
  80033c:	68 44 25 80 00       	push   $0x802544
  800341:	e8 fc 03 00 00       	call   800742 <cprintf>
  800346:	83 c4 10             	add    $0x10,%esp
  800349:	e9 c9 fe ff ff       	jmp    800217 <check_regs+0x1e4>
	CHECK(eflags, eflags);
  80034e:	83 ec 0c             	sub    $0xc,%esp
  800351:	68 44 25 80 00       	push   $0x802544
  800356:	e8 e7 03 00 00       	call   800742 <cprintf>
	CHECK(esp, esp);
  80035b:	ff 73 28             	pushl  0x28(%ebx)
  80035e:	ff 76 28             	pushl  0x28(%esi)
  800361:	68 75 25 80 00       	push   $0x802575
  800366:	68 34 25 80 00       	push   $0x802534
  80036b:	e8 d2 03 00 00       	call   800742 <cprintf>
  800370:	83 c4 20             	add    $0x20,%esp
  800373:	8b 43 28             	mov    0x28(%ebx),%eax
  800376:	39 46 28             	cmp    %eax,0x28(%esi)
  800379:	0f 85 ed fe ff ff    	jne    80026c <check_regs+0x239>
  80037f:	83 ec 0c             	sub    $0xc,%esp
  800382:	68 44 25 80 00       	push   $0x802544
  800387:	e8 b6 03 00 00       	call   800742 <cprintf>
	cprintf("Registers %s ", testname);
  80038c:	83 c4 08             	add    $0x8,%esp
  80038f:	ff 75 0c             	pushl  0xc(%ebp)
  800392:	68 79 25 80 00       	push   $0x802579
  800397:	e8 a6 03 00 00       	call   800742 <cprintf>
	if (!mismatch)
  80039c:	83 c4 10             	add    $0x10,%esp
  80039f:	85 ff                	test   %edi,%edi
  8003a1:	0f 85 e5 fe ff ff    	jne    80028c <check_regs+0x259>
		cprintf("OK\n");
  8003a7:	83 ec 0c             	sub    $0xc,%esp
  8003aa:	68 44 25 80 00       	push   $0x802544
  8003af:	e8 8e 03 00 00       	call   800742 <cprintf>
  8003b4:	83 c4 10             	add    $0x10,%esp
}
  8003b7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8003ba:	5b                   	pop    %ebx
  8003bb:	5e                   	pop    %esi
  8003bc:	5f                   	pop    %edi
  8003bd:	5d                   	pop    %ebp
  8003be:	c3                   	ret    
	CHECK(esp, esp);
  8003bf:	83 ec 0c             	sub    $0xc,%esp
  8003c2:	68 44 25 80 00       	push   $0x802544
  8003c7:	e8 76 03 00 00       	call   800742 <cprintf>
	cprintf("Registers %s ", testname);
  8003cc:	83 c4 08             	add    $0x8,%esp
  8003cf:	ff 75 0c             	pushl  0xc(%ebp)
  8003d2:	68 79 25 80 00       	push   $0x802579
  8003d7:	e8 66 03 00 00       	call   800742 <cprintf>
  8003dc:	83 c4 10             	add    $0x10,%esp
  8003df:	e9 a8 fe ff ff       	jmp    80028c <check_regs+0x259>

008003e4 <pgfault>:

static void
pgfault(struct UTrapframe *utf)
{
  8003e4:	f3 0f 1e fb          	endbr32 
  8003e8:	55                   	push   %ebp
  8003e9:	89 e5                	mov    %esp,%ebp
  8003eb:	83 ec 08             	sub    $0x8,%esp
  8003ee:	8b 45 08             	mov    0x8(%ebp),%eax
	int r;

	if (utf->utf_fault_va != (uint32_t)UTEMP)
  8003f1:	8b 10                	mov    (%eax),%edx
  8003f3:	81 fa 00 00 40 00    	cmp    $0x400000,%edx
  8003f9:	0f 85 a3 00 00 00    	jne    8004a2 <pgfault+0xbe>
		panic("pgfault expected at UTEMP, got 0x%08x (eip %08x)",
		      utf->utf_fault_va, utf->utf_eip);

	// Check registers in UTrapframe
	during.regs = utf->utf_regs;
  8003ff:	8b 50 08             	mov    0x8(%eax),%edx
  800402:	89 15 40 40 80 00    	mov    %edx,0x804040
  800408:	8b 50 0c             	mov    0xc(%eax),%edx
  80040b:	89 15 44 40 80 00    	mov    %edx,0x804044
  800411:	8b 50 10             	mov    0x10(%eax),%edx
  800414:	89 15 48 40 80 00    	mov    %edx,0x804048
  80041a:	8b 50 14             	mov    0x14(%eax),%edx
  80041d:	89 15 4c 40 80 00    	mov    %edx,0x80404c
  800423:	8b 50 18             	mov    0x18(%eax),%edx
  800426:	89 15 50 40 80 00    	mov    %edx,0x804050
  80042c:	8b 50 1c             	mov    0x1c(%eax),%edx
  80042f:	89 15 54 40 80 00    	mov    %edx,0x804054
  800435:	8b 50 20             	mov    0x20(%eax),%edx
  800438:	89 15 58 40 80 00    	mov    %edx,0x804058
  80043e:	8b 50 24             	mov    0x24(%eax),%edx
  800441:	89 15 5c 40 80 00    	mov    %edx,0x80405c
	during.eip = utf->utf_eip;
  800447:	8b 50 28             	mov    0x28(%eax),%edx
  80044a:	89 15 60 40 80 00    	mov    %edx,0x804060
	during.eflags = utf->utf_eflags & ~FL_RF;
  800450:	8b 50 2c             	mov    0x2c(%eax),%edx
  800453:	81 e2 ff ff fe ff    	and    $0xfffeffff,%edx
  800459:	89 15 64 40 80 00    	mov    %edx,0x804064
	during.esp = utf->utf_esp;
  80045f:	8b 40 30             	mov    0x30(%eax),%eax
  800462:	a3 68 40 80 00       	mov    %eax,0x804068
	check_regs(&before, "before", &during, "during", "in UTrapframe");
  800467:	83 ec 08             	sub    $0x8,%esp
  80046a:	68 9f 25 80 00       	push   $0x80259f
  80046f:	68 ad 25 80 00       	push   $0x8025ad
  800474:	b9 40 40 80 00       	mov    $0x804040,%ecx
  800479:	ba 98 25 80 00       	mov    $0x802598,%edx
  80047e:	b8 80 40 80 00       	mov    $0x804080,%eax
  800483:	e8 ab fb ff ff       	call   800033 <check_regs>

	// Map UTEMP so the write succeeds
	if ((r = sys_page_alloc(0, UTEMP, PTE_U|PTE_P|PTE_W)) < 0)
  800488:	83 c4 0c             	add    $0xc,%esp
  80048b:	6a 07                	push   $0x7
  80048d:	68 00 00 40 00       	push   $0x400000
  800492:	6a 00                	push   $0x0
  800494:	e8 c4 0c 00 00       	call   80115d <sys_page_alloc>
  800499:	83 c4 10             	add    $0x10,%esp
  80049c:	85 c0                	test   %eax,%eax
  80049e:	78 1a                	js     8004ba <pgfault+0xd6>
		panic("sys_page_alloc: %e", r);
}
  8004a0:	c9                   	leave  
  8004a1:	c3                   	ret    
		panic("pgfault expected at UTEMP, got 0x%08x (eip %08x)",
  8004a2:	83 ec 0c             	sub    $0xc,%esp
  8004a5:	ff 70 28             	pushl  0x28(%eax)
  8004a8:	52                   	push   %edx
  8004a9:	68 e0 25 80 00       	push   $0x8025e0
  8004ae:	6a 50                	push   $0x50
  8004b0:	68 87 25 80 00       	push   $0x802587
  8004b5:	e8 a1 01 00 00       	call   80065b <_panic>
		panic("sys_page_alloc: %e", r);
  8004ba:	50                   	push   %eax
  8004bb:	68 b4 25 80 00       	push   $0x8025b4
  8004c0:	6a 5c                	push   $0x5c
  8004c2:	68 87 25 80 00       	push   $0x802587
  8004c7:	e8 8f 01 00 00       	call   80065b <_panic>

008004cc <umain>:

void
umain(int argc, char **argv)
{
  8004cc:	f3 0f 1e fb          	endbr32 
  8004d0:	55                   	push   %ebp
  8004d1:	89 e5                	mov    %esp,%ebp
  8004d3:	83 ec 14             	sub    $0x14,%esp
	set_pgfault_handler(pgfault);
  8004d6:	68 e4 03 80 00       	push   $0x8003e4
  8004db:	e8 8e 0e 00 00       	call   80136e <set_pgfault_handler>

	asm volatile(
  8004e0:	50                   	push   %eax
  8004e1:	9c                   	pushf  
  8004e2:	58                   	pop    %eax
  8004e3:	0d d5 08 00 00       	or     $0x8d5,%eax
  8004e8:	50                   	push   %eax
  8004e9:	9d                   	popf   
  8004ea:	a3 a4 40 80 00       	mov    %eax,0x8040a4
  8004ef:	8d 05 2a 05 80 00    	lea    0x80052a,%eax
  8004f5:	a3 a0 40 80 00       	mov    %eax,0x8040a0
  8004fa:	58                   	pop    %eax
  8004fb:	89 3d 80 40 80 00    	mov    %edi,0x804080
  800501:	89 35 84 40 80 00    	mov    %esi,0x804084
  800507:	89 2d 88 40 80 00    	mov    %ebp,0x804088
  80050d:	89 1d 90 40 80 00    	mov    %ebx,0x804090
  800513:	89 15 94 40 80 00    	mov    %edx,0x804094
  800519:	89 0d 98 40 80 00    	mov    %ecx,0x804098
  80051f:	a3 9c 40 80 00       	mov    %eax,0x80409c
  800524:	89 25 a8 40 80 00    	mov    %esp,0x8040a8
  80052a:	c7 05 00 00 40 00 2a 	movl   $0x2a,0x400000
  800531:	00 00 00 
  800534:	89 3d 00 40 80 00    	mov    %edi,0x804000
  80053a:	89 35 04 40 80 00    	mov    %esi,0x804004
  800540:	89 2d 08 40 80 00    	mov    %ebp,0x804008
  800546:	89 1d 10 40 80 00    	mov    %ebx,0x804010
  80054c:	89 15 14 40 80 00    	mov    %edx,0x804014
  800552:	89 0d 18 40 80 00    	mov    %ecx,0x804018
  800558:	a3 1c 40 80 00       	mov    %eax,0x80401c
  80055d:	89 25 28 40 80 00    	mov    %esp,0x804028
  800563:	8b 3d 80 40 80 00    	mov    0x804080,%edi
  800569:	8b 35 84 40 80 00    	mov    0x804084,%esi
  80056f:	8b 2d 88 40 80 00    	mov    0x804088,%ebp
  800575:	8b 1d 90 40 80 00    	mov    0x804090,%ebx
  80057b:	8b 15 94 40 80 00    	mov    0x804094,%edx
  800581:	8b 0d 98 40 80 00    	mov    0x804098,%ecx
  800587:	a1 9c 40 80 00       	mov    0x80409c,%eax
  80058c:	8b 25 a8 40 80 00    	mov    0x8040a8,%esp
  800592:	50                   	push   %eax
  800593:	9c                   	pushf  
  800594:	58                   	pop    %eax
  800595:	a3 24 40 80 00       	mov    %eax,0x804024
  80059a:	58                   	pop    %eax
		: : "m" (before), "m" (after) : "memory", "cc");

	// Check UTEMP to roughly determine that EIP was restored
	// correctly (of course, we probably wouldn't get this far if
	// it weren't)
	if (*(int*)UTEMP != 42)
  80059b:	83 c4 10             	add    $0x10,%esp
  80059e:	83 3d 00 00 40 00 2a 	cmpl   $0x2a,0x400000
  8005a5:	75 30                	jne    8005d7 <umain+0x10b>
		cprintf("EIP after page-fault MISMATCH\n");
	after.eip = before.eip;
  8005a7:	a1 a0 40 80 00       	mov    0x8040a0,%eax
  8005ac:	a3 20 40 80 00       	mov    %eax,0x804020

	check_regs(&before, "before", &after, "after", "after page-fault");
  8005b1:	83 ec 08             	sub    $0x8,%esp
  8005b4:	68 c7 25 80 00       	push   $0x8025c7
  8005b9:	68 d8 25 80 00       	push   $0x8025d8
  8005be:	b9 00 40 80 00       	mov    $0x804000,%ecx
  8005c3:	ba 98 25 80 00       	mov    $0x802598,%edx
  8005c8:	b8 80 40 80 00       	mov    $0x804080,%eax
  8005cd:	e8 61 fa ff ff       	call   800033 <check_regs>
}
  8005d2:	83 c4 10             	add    $0x10,%esp
  8005d5:	c9                   	leave  
  8005d6:	c3                   	ret    
		cprintf("EIP after page-fault MISMATCH\n");
  8005d7:	83 ec 0c             	sub    $0xc,%esp
  8005da:	68 14 26 80 00       	push   $0x802614
  8005df:	e8 5e 01 00 00       	call   800742 <cprintf>
  8005e4:	83 c4 10             	add    $0x10,%esp
  8005e7:	eb be                	jmp    8005a7 <umain+0xdb>

008005e9 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8005e9:	f3 0f 1e fb          	endbr32 
  8005ed:	55                   	push   %ebp
  8005ee:	89 e5                	mov    %esp,%ebp
  8005f0:	56                   	push   %esi
  8005f1:	53                   	push   %ebx
  8005f2:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8005f5:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  8005f8:	c7 05 b0 40 80 00 00 	movl   $0x0,0x8040b0
  8005ff:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  800602:	e8 10 0b 00 00       	call   801117 <sys_getenvid>
  800607:	25 ff 03 00 00       	and    $0x3ff,%eax
  80060c:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80060f:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  800614:	a3 b0 40 80 00       	mov    %eax,0x8040b0

	// save the name of the program so that panic() can use it
	if (argc > 0)
  800619:	85 db                	test   %ebx,%ebx
  80061b:	7e 07                	jle    800624 <libmain+0x3b>
		binaryname = argv[0];
  80061d:	8b 06                	mov    (%esi),%eax
  80061f:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  800624:	83 ec 08             	sub    $0x8,%esp
  800627:	56                   	push   %esi
  800628:	53                   	push   %ebx
  800629:	e8 9e fe ff ff       	call   8004cc <umain>

	// exit gracefully
	exit();
  80062e:	e8 0a 00 00 00       	call   80063d <exit>
}
  800633:	83 c4 10             	add    $0x10,%esp
  800636:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800639:	5b                   	pop    %ebx
  80063a:	5e                   	pop    %esi
  80063b:	5d                   	pop    %ebp
  80063c:	c3                   	ret    

0080063d <exit>:

#include <inc/lib.h>

void
exit(void)
{
  80063d:	f3 0f 1e fb          	endbr32 
  800641:	55                   	push   %ebp
  800642:	89 e5                	mov    %esp,%ebp
  800644:	83 ec 08             	sub    $0x8,%esp
	close_all();
  800647:	e8 b2 0f 00 00       	call   8015fe <close_all>
	sys_env_destroy(0);
  80064c:	83 ec 0c             	sub    $0xc,%esp
  80064f:	6a 00                	push   $0x0
  800651:	e8 7c 0a 00 00       	call   8010d2 <sys_env_destroy>
}
  800656:	83 c4 10             	add    $0x10,%esp
  800659:	c9                   	leave  
  80065a:	c3                   	ret    

0080065b <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  80065b:	f3 0f 1e fb          	endbr32 
  80065f:	55                   	push   %ebp
  800660:	89 e5                	mov    %esp,%ebp
  800662:	56                   	push   %esi
  800663:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  800664:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  800667:	8b 35 00 30 80 00    	mov    0x803000,%esi
  80066d:	e8 a5 0a 00 00       	call   801117 <sys_getenvid>
  800672:	83 ec 0c             	sub    $0xc,%esp
  800675:	ff 75 0c             	pushl  0xc(%ebp)
  800678:	ff 75 08             	pushl  0x8(%ebp)
  80067b:	56                   	push   %esi
  80067c:	50                   	push   %eax
  80067d:	68 40 26 80 00       	push   $0x802640
  800682:	e8 bb 00 00 00       	call   800742 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  800687:	83 c4 18             	add    $0x18,%esp
  80068a:	53                   	push   %ebx
  80068b:	ff 75 10             	pushl  0x10(%ebp)
  80068e:	e8 5a 00 00 00       	call   8006ed <vcprintf>
	cprintf("\n");
  800693:	c7 04 24 50 25 80 00 	movl   $0x802550,(%esp)
  80069a:	e8 a3 00 00 00       	call   800742 <cprintf>
  80069f:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  8006a2:	cc                   	int3   
  8006a3:	eb fd                	jmp    8006a2 <_panic+0x47>

008006a5 <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  8006a5:	f3 0f 1e fb          	endbr32 
  8006a9:	55                   	push   %ebp
  8006aa:	89 e5                	mov    %esp,%ebp
  8006ac:	53                   	push   %ebx
  8006ad:	83 ec 04             	sub    $0x4,%esp
  8006b0:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  8006b3:	8b 13                	mov    (%ebx),%edx
  8006b5:	8d 42 01             	lea    0x1(%edx),%eax
  8006b8:	89 03                	mov    %eax,(%ebx)
  8006ba:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8006bd:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  8006c1:	3d ff 00 00 00       	cmp    $0xff,%eax
  8006c6:	74 09                	je     8006d1 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  8006c8:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  8006cc:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8006cf:	c9                   	leave  
  8006d0:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  8006d1:	83 ec 08             	sub    $0x8,%esp
  8006d4:	68 ff 00 00 00       	push   $0xff
  8006d9:	8d 43 08             	lea    0x8(%ebx),%eax
  8006dc:	50                   	push   %eax
  8006dd:	e8 ab 09 00 00       	call   80108d <sys_cputs>
		b->idx = 0;
  8006e2:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8006e8:	83 c4 10             	add    $0x10,%esp
  8006eb:	eb db                	jmp    8006c8 <putch+0x23>

008006ed <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  8006ed:	f3 0f 1e fb          	endbr32 
  8006f1:	55                   	push   %ebp
  8006f2:	89 e5                	mov    %esp,%ebp
  8006f4:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  8006fa:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  800701:	00 00 00 
	b.cnt = 0;
  800704:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  80070b:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  80070e:	ff 75 0c             	pushl  0xc(%ebp)
  800711:	ff 75 08             	pushl  0x8(%ebp)
  800714:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  80071a:	50                   	push   %eax
  80071b:	68 a5 06 80 00       	push   $0x8006a5
  800720:	e8 20 01 00 00       	call   800845 <vprintfmt>
	sys_cputs(b.buf, b.idx);
  800725:	83 c4 08             	add    $0x8,%esp
  800728:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  80072e:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  800734:	50                   	push   %eax
  800735:	e8 53 09 00 00       	call   80108d <sys_cputs>

	return b.cnt;
}
  80073a:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  800740:	c9                   	leave  
  800741:	c3                   	ret    

00800742 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  800742:	f3 0f 1e fb          	endbr32 
  800746:	55                   	push   %ebp
  800747:	89 e5                	mov    %esp,%ebp
  800749:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  80074c:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  80074f:	50                   	push   %eax
  800750:	ff 75 08             	pushl  0x8(%ebp)
  800753:	e8 95 ff ff ff       	call   8006ed <vcprintf>
	va_end(ap);

	return cnt;
}
  800758:	c9                   	leave  
  800759:	c3                   	ret    

0080075a <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  80075a:	55                   	push   %ebp
  80075b:	89 e5                	mov    %esp,%ebp
  80075d:	57                   	push   %edi
  80075e:	56                   	push   %esi
  80075f:	53                   	push   %ebx
  800760:	83 ec 1c             	sub    $0x1c,%esp
  800763:	89 c7                	mov    %eax,%edi
  800765:	89 d6                	mov    %edx,%esi
  800767:	8b 45 08             	mov    0x8(%ebp),%eax
  80076a:	8b 55 0c             	mov    0xc(%ebp),%edx
  80076d:	89 d1                	mov    %edx,%ecx
  80076f:	89 c2                	mov    %eax,%edx
  800771:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800774:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800777:	8b 45 10             	mov    0x10(%ebp),%eax
  80077a:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  80077d:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800780:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  800787:	39 c2                	cmp    %eax,%edx
  800789:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  80078c:	72 3e                	jb     8007cc <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  80078e:	83 ec 0c             	sub    $0xc,%esp
  800791:	ff 75 18             	pushl  0x18(%ebp)
  800794:	83 eb 01             	sub    $0x1,%ebx
  800797:	53                   	push   %ebx
  800798:	50                   	push   %eax
  800799:	83 ec 08             	sub    $0x8,%esp
  80079c:	ff 75 e4             	pushl  -0x1c(%ebp)
  80079f:	ff 75 e0             	pushl  -0x20(%ebp)
  8007a2:	ff 75 dc             	pushl  -0x24(%ebp)
  8007a5:	ff 75 d8             	pushl  -0x28(%ebp)
  8007a8:	e8 03 1b 00 00       	call   8022b0 <__udivdi3>
  8007ad:	83 c4 18             	add    $0x18,%esp
  8007b0:	52                   	push   %edx
  8007b1:	50                   	push   %eax
  8007b2:	89 f2                	mov    %esi,%edx
  8007b4:	89 f8                	mov    %edi,%eax
  8007b6:	e8 9f ff ff ff       	call   80075a <printnum>
  8007bb:	83 c4 20             	add    $0x20,%esp
  8007be:	eb 13                	jmp    8007d3 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  8007c0:	83 ec 08             	sub    $0x8,%esp
  8007c3:	56                   	push   %esi
  8007c4:	ff 75 18             	pushl  0x18(%ebp)
  8007c7:	ff d7                	call   *%edi
  8007c9:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  8007cc:	83 eb 01             	sub    $0x1,%ebx
  8007cf:	85 db                	test   %ebx,%ebx
  8007d1:	7f ed                	jg     8007c0 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  8007d3:	83 ec 08             	sub    $0x8,%esp
  8007d6:	56                   	push   %esi
  8007d7:	83 ec 04             	sub    $0x4,%esp
  8007da:	ff 75 e4             	pushl  -0x1c(%ebp)
  8007dd:	ff 75 e0             	pushl  -0x20(%ebp)
  8007e0:	ff 75 dc             	pushl  -0x24(%ebp)
  8007e3:	ff 75 d8             	pushl  -0x28(%ebp)
  8007e6:	e8 d5 1b 00 00       	call   8023c0 <__umoddi3>
  8007eb:	83 c4 14             	add    $0x14,%esp
  8007ee:	0f be 80 63 26 80 00 	movsbl 0x802663(%eax),%eax
  8007f5:	50                   	push   %eax
  8007f6:	ff d7                	call   *%edi
}
  8007f8:	83 c4 10             	add    $0x10,%esp
  8007fb:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8007fe:	5b                   	pop    %ebx
  8007ff:	5e                   	pop    %esi
  800800:	5f                   	pop    %edi
  800801:	5d                   	pop    %ebp
  800802:	c3                   	ret    

00800803 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  800803:	f3 0f 1e fb          	endbr32 
  800807:	55                   	push   %ebp
  800808:	89 e5                	mov    %esp,%ebp
  80080a:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  80080d:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  800811:	8b 10                	mov    (%eax),%edx
  800813:	3b 50 04             	cmp    0x4(%eax),%edx
  800816:	73 0a                	jae    800822 <sprintputch+0x1f>
		*b->buf++ = ch;
  800818:	8d 4a 01             	lea    0x1(%edx),%ecx
  80081b:	89 08                	mov    %ecx,(%eax)
  80081d:	8b 45 08             	mov    0x8(%ebp),%eax
  800820:	88 02                	mov    %al,(%edx)
}
  800822:	5d                   	pop    %ebp
  800823:	c3                   	ret    

00800824 <printfmt>:
{
  800824:	f3 0f 1e fb          	endbr32 
  800828:	55                   	push   %ebp
  800829:	89 e5                	mov    %esp,%ebp
  80082b:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  80082e:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  800831:	50                   	push   %eax
  800832:	ff 75 10             	pushl  0x10(%ebp)
  800835:	ff 75 0c             	pushl  0xc(%ebp)
  800838:	ff 75 08             	pushl  0x8(%ebp)
  80083b:	e8 05 00 00 00       	call   800845 <vprintfmt>
}
  800840:	83 c4 10             	add    $0x10,%esp
  800843:	c9                   	leave  
  800844:	c3                   	ret    

00800845 <vprintfmt>:
{
  800845:	f3 0f 1e fb          	endbr32 
  800849:	55                   	push   %ebp
  80084a:	89 e5                	mov    %esp,%ebp
  80084c:	57                   	push   %edi
  80084d:	56                   	push   %esi
  80084e:	53                   	push   %ebx
  80084f:	83 ec 3c             	sub    $0x3c,%esp
  800852:	8b 75 08             	mov    0x8(%ebp),%esi
  800855:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  800858:	8b 7d 10             	mov    0x10(%ebp),%edi
  80085b:	e9 5d 03 00 00       	jmp    800bbd <vprintfmt+0x378>
		padc = ' ';
  800860:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  800864:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  80086b:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800872:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  800879:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  80087e:	8d 47 01             	lea    0x1(%edi),%eax
  800881:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800884:	0f b6 17             	movzbl (%edi),%edx
  800887:	8d 42 dd             	lea    -0x23(%edx),%eax
  80088a:	3c 55                	cmp    $0x55,%al
  80088c:	0f 87 ae 03 00 00    	ja     800c40 <vprintfmt+0x3fb>
  800892:	0f b6 c0             	movzbl %al,%eax
  800895:	3e ff 24 85 a0 27 80 	notrack jmp *0x8027a0(,%eax,4)
  80089c:	00 
  80089d:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  8008a0:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  8008a4:	eb d8                	jmp    80087e <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8008a6:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  8008a9:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  8008ad:	eb cf                	jmp    80087e <vprintfmt+0x39>
  8008af:	0f b6 d2             	movzbl %dl,%edx
  8008b2:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  8008b5:	b8 00 00 00 00       	mov    $0x0,%eax
  8008ba:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  8008bd:	8d 04 80             	lea    (%eax,%eax,4),%eax
  8008c0:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  8008c4:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  8008c7:	8d 4a d0             	lea    -0x30(%edx),%ecx
  8008ca:	83 f9 09             	cmp    $0x9,%ecx
  8008cd:	77 55                	ja     800924 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  8008cf:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  8008d2:	eb e9                	jmp    8008bd <vprintfmt+0x78>
			precision = va_arg(ap, int);
  8008d4:	8b 45 14             	mov    0x14(%ebp),%eax
  8008d7:	8b 00                	mov    (%eax),%eax
  8008d9:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8008dc:	8b 45 14             	mov    0x14(%ebp),%eax
  8008df:	8d 40 04             	lea    0x4(%eax),%eax
  8008e2:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8008e5:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8008e8:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8008ec:	79 90                	jns    80087e <vprintfmt+0x39>
				width = precision, precision = -1;
  8008ee:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8008f1:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8008f4:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  8008fb:	eb 81                	jmp    80087e <vprintfmt+0x39>
  8008fd:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  800900:	85 c0                	test   %eax,%eax
  800902:	ba 00 00 00 00       	mov    $0x0,%edx
  800907:	0f 49 d0             	cmovns %eax,%edx
  80090a:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  80090d:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800910:	e9 69 ff ff ff       	jmp    80087e <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  800915:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  800918:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  80091f:	e9 5a ff ff ff       	jmp    80087e <vprintfmt+0x39>
  800924:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  800927:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80092a:	eb bc                	jmp    8008e8 <vprintfmt+0xa3>
			lflag++;
  80092c:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  80092f:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800932:	e9 47 ff ff ff       	jmp    80087e <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  800937:	8b 45 14             	mov    0x14(%ebp),%eax
  80093a:	8d 78 04             	lea    0x4(%eax),%edi
  80093d:	83 ec 08             	sub    $0x8,%esp
  800940:	53                   	push   %ebx
  800941:	ff 30                	pushl  (%eax)
  800943:	ff d6                	call   *%esi
			break;
  800945:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  800948:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  80094b:	e9 6a 02 00 00       	jmp    800bba <vprintfmt+0x375>
			err = va_arg(ap, int);
  800950:	8b 45 14             	mov    0x14(%ebp),%eax
  800953:	8d 78 04             	lea    0x4(%eax),%edi
  800956:	8b 00                	mov    (%eax),%eax
  800958:	99                   	cltd   
  800959:	31 d0                	xor    %edx,%eax
  80095b:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  80095d:	83 f8 0f             	cmp    $0xf,%eax
  800960:	7f 23                	jg     800985 <vprintfmt+0x140>
  800962:	8b 14 85 00 29 80 00 	mov    0x802900(,%eax,4),%edx
  800969:	85 d2                	test   %edx,%edx
  80096b:	74 18                	je     800985 <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  80096d:	52                   	push   %edx
  80096e:	68 a1 2a 80 00       	push   $0x802aa1
  800973:	53                   	push   %ebx
  800974:	56                   	push   %esi
  800975:	e8 aa fe ff ff       	call   800824 <printfmt>
  80097a:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80097d:	89 7d 14             	mov    %edi,0x14(%ebp)
  800980:	e9 35 02 00 00       	jmp    800bba <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  800985:	50                   	push   %eax
  800986:	68 7b 26 80 00       	push   $0x80267b
  80098b:	53                   	push   %ebx
  80098c:	56                   	push   %esi
  80098d:	e8 92 fe ff ff       	call   800824 <printfmt>
  800992:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800995:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  800998:	e9 1d 02 00 00       	jmp    800bba <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  80099d:	8b 45 14             	mov    0x14(%ebp),%eax
  8009a0:	83 c0 04             	add    $0x4,%eax
  8009a3:	89 45 c8             	mov    %eax,-0x38(%ebp)
  8009a6:	8b 45 14             	mov    0x14(%ebp),%eax
  8009a9:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  8009ab:	85 d2                	test   %edx,%edx
  8009ad:	b8 74 26 80 00       	mov    $0x802674,%eax
  8009b2:	0f 45 c2             	cmovne %edx,%eax
  8009b5:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  8009b8:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8009bc:	7e 06                	jle    8009c4 <vprintfmt+0x17f>
  8009be:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  8009c2:	75 0d                	jne    8009d1 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  8009c4:	8b 45 cc             	mov    -0x34(%ebp),%eax
  8009c7:	89 c7                	mov    %eax,%edi
  8009c9:	03 45 d4             	add    -0x2c(%ebp),%eax
  8009cc:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8009cf:	eb 55                	jmp    800a26 <vprintfmt+0x1e1>
  8009d1:	83 ec 08             	sub    $0x8,%esp
  8009d4:	ff 75 d8             	pushl  -0x28(%ebp)
  8009d7:	ff 75 cc             	pushl  -0x34(%ebp)
  8009da:	e8 15 03 00 00       	call   800cf4 <strnlen>
  8009df:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8009e2:	29 c2                	sub    %eax,%edx
  8009e4:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8009e7:	83 c4 10             	add    $0x10,%esp
  8009ea:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  8009ec:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  8009f0:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  8009f3:	85 ff                	test   %edi,%edi
  8009f5:	7e 11                	jle    800a08 <vprintfmt+0x1c3>
					putch(padc, putdat);
  8009f7:	83 ec 08             	sub    $0x8,%esp
  8009fa:	53                   	push   %ebx
  8009fb:	ff 75 d4             	pushl  -0x2c(%ebp)
  8009fe:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  800a00:	83 ef 01             	sub    $0x1,%edi
  800a03:	83 c4 10             	add    $0x10,%esp
  800a06:	eb eb                	jmp    8009f3 <vprintfmt+0x1ae>
  800a08:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  800a0b:	85 d2                	test   %edx,%edx
  800a0d:	b8 00 00 00 00       	mov    $0x0,%eax
  800a12:	0f 49 c2             	cmovns %edx,%eax
  800a15:	29 c2                	sub    %eax,%edx
  800a17:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  800a1a:	eb a8                	jmp    8009c4 <vprintfmt+0x17f>
					putch(ch, putdat);
  800a1c:	83 ec 08             	sub    $0x8,%esp
  800a1f:	53                   	push   %ebx
  800a20:	52                   	push   %edx
  800a21:	ff d6                	call   *%esi
  800a23:	83 c4 10             	add    $0x10,%esp
  800a26:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  800a29:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800a2b:	83 c7 01             	add    $0x1,%edi
  800a2e:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800a32:	0f be d0             	movsbl %al,%edx
  800a35:	85 d2                	test   %edx,%edx
  800a37:	74 4b                	je     800a84 <vprintfmt+0x23f>
  800a39:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800a3d:	78 06                	js     800a45 <vprintfmt+0x200>
  800a3f:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  800a43:	78 1e                	js     800a63 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  800a45:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  800a49:	74 d1                	je     800a1c <vprintfmt+0x1d7>
  800a4b:	0f be c0             	movsbl %al,%eax
  800a4e:	83 e8 20             	sub    $0x20,%eax
  800a51:	83 f8 5e             	cmp    $0x5e,%eax
  800a54:	76 c6                	jbe    800a1c <vprintfmt+0x1d7>
					putch('?', putdat);
  800a56:	83 ec 08             	sub    $0x8,%esp
  800a59:	53                   	push   %ebx
  800a5a:	6a 3f                	push   $0x3f
  800a5c:	ff d6                	call   *%esi
  800a5e:	83 c4 10             	add    $0x10,%esp
  800a61:	eb c3                	jmp    800a26 <vprintfmt+0x1e1>
  800a63:	89 cf                	mov    %ecx,%edi
  800a65:	eb 0e                	jmp    800a75 <vprintfmt+0x230>
				putch(' ', putdat);
  800a67:	83 ec 08             	sub    $0x8,%esp
  800a6a:	53                   	push   %ebx
  800a6b:	6a 20                	push   $0x20
  800a6d:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800a6f:	83 ef 01             	sub    $0x1,%edi
  800a72:	83 c4 10             	add    $0x10,%esp
  800a75:	85 ff                	test   %edi,%edi
  800a77:	7f ee                	jg     800a67 <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  800a79:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800a7c:	89 45 14             	mov    %eax,0x14(%ebp)
  800a7f:	e9 36 01 00 00       	jmp    800bba <vprintfmt+0x375>
  800a84:	89 cf                	mov    %ecx,%edi
  800a86:	eb ed                	jmp    800a75 <vprintfmt+0x230>
	if (lflag >= 2)
  800a88:	83 f9 01             	cmp    $0x1,%ecx
  800a8b:	7f 1f                	jg     800aac <vprintfmt+0x267>
	else if (lflag)
  800a8d:	85 c9                	test   %ecx,%ecx
  800a8f:	74 67                	je     800af8 <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800a91:	8b 45 14             	mov    0x14(%ebp),%eax
  800a94:	8b 00                	mov    (%eax),%eax
  800a96:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800a99:	89 c1                	mov    %eax,%ecx
  800a9b:	c1 f9 1f             	sar    $0x1f,%ecx
  800a9e:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800aa1:	8b 45 14             	mov    0x14(%ebp),%eax
  800aa4:	8d 40 04             	lea    0x4(%eax),%eax
  800aa7:	89 45 14             	mov    %eax,0x14(%ebp)
  800aaa:	eb 17                	jmp    800ac3 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800aac:	8b 45 14             	mov    0x14(%ebp),%eax
  800aaf:	8b 50 04             	mov    0x4(%eax),%edx
  800ab2:	8b 00                	mov    (%eax),%eax
  800ab4:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800ab7:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800aba:	8b 45 14             	mov    0x14(%ebp),%eax
  800abd:	8d 40 08             	lea    0x8(%eax),%eax
  800ac0:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800ac3:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800ac6:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  800ac9:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  800ace:	85 c9                	test   %ecx,%ecx
  800ad0:	0f 89 ca 00 00 00    	jns    800ba0 <vprintfmt+0x35b>
				putch('-', putdat);
  800ad6:	83 ec 08             	sub    $0x8,%esp
  800ad9:	53                   	push   %ebx
  800ada:	6a 2d                	push   $0x2d
  800adc:	ff d6                	call   *%esi
				num = -(long long) num;
  800ade:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800ae1:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  800ae4:	f7 da                	neg    %edx
  800ae6:	83 d1 00             	adc    $0x0,%ecx
  800ae9:	f7 d9                	neg    %ecx
  800aeb:	83 c4 10             	add    $0x10,%esp
			base = 10;
  800aee:	b8 0a 00 00 00       	mov    $0xa,%eax
  800af3:	e9 a8 00 00 00       	jmp    800ba0 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  800af8:	8b 45 14             	mov    0x14(%ebp),%eax
  800afb:	8b 00                	mov    (%eax),%eax
  800afd:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800b00:	99                   	cltd   
  800b01:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800b04:	8b 45 14             	mov    0x14(%ebp),%eax
  800b07:	8d 40 04             	lea    0x4(%eax),%eax
  800b0a:	89 45 14             	mov    %eax,0x14(%ebp)
  800b0d:	eb b4                	jmp    800ac3 <vprintfmt+0x27e>
	if (lflag >= 2)
  800b0f:	83 f9 01             	cmp    $0x1,%ecx
  800b12:	7f 1b                	jg     800b2f <vprintfmt+0x2ea>
	else if (lflag)
  800b14:	85 c9                	test   %ecx,%ecx
  800b16:	74 2c                	je     800b44 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  800b18:	8b 45 14             	mov    0x14(%ebp),%eax
  800b1b:	8b 10                	mov    (%eax),%edx
  800b1d:	b9 00 00 00 00       	mov    $0x0,%ecx
  800b22:	8d 40 04             	lea    0x4(%eax),%eax
  800b25:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800b28:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800b2d:	eb 71                	jmp    800ba0 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800b2f:	8b 45 14             	mov    0x14(%ebp),%eax
  800b32:	8b 10                	mov    (%eax),%edx
  800b34:	8b 48 04             	mov    0x4(%eax),%ecx
  800b37:	8d 40 08             	lea    0x8(%eax),%eax
  800b3a:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800b3d:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  800b42:	eb 5c                	jmp    800ba0 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800b44:	8b 45 14             	mov    0x14(%ebp),%eax
  800b47:	8b 10                	mov    (%eax),%edx
  800b49:	b9 00 00 00 00       	mov    $0x0,%ecx
  800b4e:	8d 40 04             	lea    0x4(%eax),%eax
  800b51:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800b54:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  800b59:	eb 45                	jmp    800ba0 <vprintfmt+0x35b>
			putch('X', putdat);
  800b5b:	83 ec 08             	sub    $0x8,%esp
  800b5e:	53                   	push   %ebx
  800b5f:	6a 58                	push   $0x58
  800b61:	ff d6                	call   *%esi
			putch('X', putdat);
  800b63:	83 c4 08             	add    $0x8,%esp
  800b66:	53                   	push   %ebx
  800b67:	6a 58                	push   $0x58
  800b69:	ff d6                	call   *%esi
			putch('X', putdat);
  800b6b:	83 c4 08             	add    $0x8,%esp
  800b6e:	53                   	push   %ebx
  800b6f:	6a 58                	push   $0x58
  800b71:	ff d6                	call   *%esi
			break;
  800b73:	83 c4 10             	add    $0x10,%esp
  800b76:	eb 42                	jmp    800bba <vprintfmt+0x375>
			putch('0', putdat);
  800b78:	83 ec 08             	sub    $0x8,%esp
  800b7b:	53                   	push   %ebx
  800b7c:	6a 30                	push   $0x30
  800b7e:	ff d6                	call   *%esi
			putch('x', putdat);
  800b80:	83 c4 08             	add    $0x8,%esp
  800b83:	53                   	push   %ebx
  800b84:	6a 78                	push   $0x78
  800b86:	ff d6                	call   *%esi
			num = (unsigned long long)
  800b88:	8b 45 14             	mov    0x14(%ebp),%eax
  800b8b:	8b 10                	mov    (%eax),%edx
  800b8d:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800b92:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  800b95:	8d 40 04             	lea    0x4(%eax),%eax
  800b98:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800b9b:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800ba0:	83 ec 0c             	sub    $0xc,%esp
  800ba3:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  800ba7:	57                   	push   %edi
  800ba8:	ff 75 d4             	pushl  -0x2c(%ebp)
  800bab:	50                   	push   %eax
  800bac:	51                   	push   %ecx
  800bad:	52                   	push   %edx
  800bae:	89 da                	mov    %ebx,%edx
  800bb0:	89 f0                	mov    %esi,%eax
  800bb2:	e8 a3 fb ff ff       	call   80075a <printnum>
			break;
  800bb7:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  800bba:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800bbd:	83 c7 01             	add    $0x1,%edi
  800bc0:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800bc4:	83 f8 25             	cmp    $0x25,%eax
  800bc7:	0f 84 93 fc ff ff    	je     800860 <vprintfmt+0x1b>
			if (ch == '\0')
  800bcd:	85 c0                	test   %eax,%eax
  800bcf:	0f 84 8b 00 00 00    	je     800c60 <vprintfmt+0x41b>
			putch(ch, putdat);
  800bd5:	83 ec 08             	sub    $0x8,%esp
  800bd8:	53                   	push   %ebx
  800bd9:	50                   	push   %eax
  800bda:	ff d6                	call   *%esi
  800bdc:	83 c4 10             	add    $0x10,%esp
  800bdf:	eb dc                	jmp    800bbd <vprintfmt+0x378>
	if (lflag >= 2)
  800be1:	83 f9 01             	cmp    $0x1,%ecx
  800be4:	7f 1b                	jg     800c01 <vprintfmt+0x3bc>
	else if (lflag)
  800be6:	85 c9                	test   %ecx,%ecx
  800be8:	74 2c                	je     800c16 <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  800bea:	8b 45 14             	mov    0x14(%ebp),%eax
  800bed:	8b 10                	mov    (%eax),%edx
  800bef:	b9 00 00 00 00       	mov    $0x0,%ecx
  800bf4:	8d 40 04             	lea    0x4(%eax),%eax
  800bf7:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800bfa:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  800bff:	eb 9f                	jmp    800ba0 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800c01:	8b 45 14             	mov    0x14(%ebp),%eax
  800c04:	8b 10                	mov    (%eax),%edx
  800c06:	8b 48 04             	mov    0x4(%eax),%ecx
  800c09:	8d 40 08             	lea    0x8(%eax),%eax
  800c0c:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800c0f:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  800c14:	eb 8a                	jmp    800ba0 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800c16:	8b 45 14             	mov    0x14(%ebp),%eax
  800c19:	8b 10                	mov    (%eax),%edx
  800c1b:	b9 00 00 00 00       	mov    $0x0,%ecx
  800c20:	8d 40 04             	lea    0x4(%eax),%eax
  800c23:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800c26:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  800c2b:	e9 70 ff ff ff       	jmp    800ba0 <vprintfmt+0x35b>
			putch(ch, putdat);
  800c30:	83 ec 08             	sub    $0x8,%esp
  800c33:	53                   	push   %ebx
  800c34:	6a 25                	push   $0x25
  800c36:	ff d6                	call   *%esi
			break;
  800c38:	83 c4 10             	add    $0x10,%esp
  800c3b:	e9 7a ff ff ff       	jmp    800bba <vprintfmt+0x375>
			putch('%', putdat);
  800c40:	83 ec 08             	sub    $0x8,%esp
  800c43:	53                   	push   %ebx
  800c44:	6a 25                	push   $0x25
  800c46:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  800c48:	83 c4 10             	add    $0x10,%esp
  800c4b:	89 f8                	mov    %edi,%eax
  800c4d:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  800c51:	74 05                	je     800c58 <vprintfmt+0x413>
  800c53:	83 e8 01             	sub    $0x1,%eax
  800c56:	eb f5                	jmp    800c4d <vprintfmt+0x408>
  800c58:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800c5b:	e9 5a ff ff ff       	jmp    800bba <vprintfmt+0x375>
}
  800c60:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c63:	5b                   	pop    %ebx
  800c64:	5e                   	pop    %esi
  800c65:	5f                   	pop    %edi
  800c66:	5d                   	pop    %ebp
  800c67:	c3                   	ret    

00800c68 <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  800c68:	f3 0f 1e fb          	endbr32 
  800c6c:	55                   	push   %ebp
  800c6d:	89 e5                	mov    %esp,%ebp
  800c6f:	83 ec 18             	sub    $0x18,%esp
  800c72:	8b 45 08             	mov    0x8(%ebp),%eax
  800c75:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  800c78:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800c7b:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800c7f:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800c82:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  800c89:	85 c0                	test   %eax,%eax
  800c8b:	74 26                	je     800cb3 <vsnprintf+0x4b>
  800c8d:	85 d2                	test   %edx,%edx
  800c8f:	7e 22                	jle    800cb3 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800c91:	ff 75 14             	pushl  0x14(%ebp)
  800c94:	ff 75 10             	pushl  0x10(%ebp)
  800c97:	8d 45 ec             	lea    -0x14(%ebp),%eax
  800c9a:	50                   	push   %eax
  800c9b:	68 03 08 80 00       	push   $0x800803
  800ca0:	e8 a0 fb ff ff       	call   800845 <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  800ca5:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800ca8:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800cab:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800cae:	83 c4 10             	add    $0x10,%esp
}
  800cb1:	c9                   	leave  
  800cb2:	c3                   	ret    
		return -E_INVAL;
  800cb3:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800cb8:	eb f7                	jmp    800cb1 <vsnprintf+0x49>

00800cba <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  800cba:	f3 0f 1e fb          	endbr32 
  800cbe:	55                   	push   %ebp
  800cbf:	89 e5                	mov    %esp,%ebp
  800cc1:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  800cc4:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  800cc7:	50                   	push   %eax
  800cc8:	ff 75 10             	pushl  0x10(%ebp)
  800ccb:	ff 75 0c             	pushl  0xc(%ebp)
  800cce:	ff 75 08             	pushl  0x8(%ebp)
  800cd1:	e8 92 ff ff ff       	call   800c68 <vsnprintf>
	va_end(ap);

	return rc;
}
  800cd6:	c9                   	leave  
  800cd7:	c3                   	ret    

00800cd8 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  800cd8:	f3 0f 1e fb          	endbr32 
  800cdc:	55                   	push   %ebp
  800cdd:	89 e5                	mov    %esp,%ebp
  800cdf:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  800ce2:	b8 00 00 00 00       	mov    $0x0,%eax
  800ce7:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  800ceb:	74 05                	je     800cf2 <strlen+0x1a>
		n++;
  800ced:	83 c0 01             	add    $0x1,%eax
  800cf0:	eb f5                	jmp    800ce7 <strlen+0xf>
	return n;
}
  800cf2:	5d                   	pop    %ebp
  800cf3:	c3                   	ret    

00800cf4 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  800cf4:	f3 0f 1e fb          	endbr32 
  800cf8:	55                   	push   %ebp
  800cf9:	89 e5                	mov    %esp,%ebp
  800cfb:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800cfe:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  800d01:	b8 00 00 00 00       	mov    $0x0,%eax
  800d06:	39 d0                	cmp    %edx,%eax
  800d08:	74 0d                	je     800d17 <strnlen+0x23>
  800d0a:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  800d0e:	74 05                	je     800d15 <strnlen+0x21>
		n++;
  800d10:	83 c0 01             	add    $0x1,%eax
  800d13:	eb f1                	jmp    800d06 <strnlen+0x12>
  800d15:	89 c2                	mov    %eax,%edx
	return n;
}
  800d17:	89 d0                	mov    %edx,%eax
  800d19:	5d                   	pop    %ebp
  800d1a:	c3                   	ret    

00800d1b <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800d1b:	f3 0f 1e fb          	endbr32 
  800d1f:	55                   	push   %ebp
  800d20:	89 e5                	mov    %esp,%ebp
  800d22:	53                   	push   %ebx
  800d23:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800d26:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  800d29:	b8 00 00 00 00       	mov    $0x0,%eax
  800d2e:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800d32:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  800d35:	83 c0 01             	add    $0x1,%eax
  800d38:	84 d2                	test   %dl,%dl
  800d3a:	75 f2                	jne    800d2e <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800d3c:	89 c8                	mov    %ecx,%eax
  800d3e:	5b                   	pop    %ebx
  800d3f:	5d                   	pop    %ebp
  800d40:	c3                   	ret    

00800d41 <strcat>:

char *
strcat(char *dst, const char *src)
{
  800d41:	f3 0f 1e fb          	endbr32 
  800d45:	55                   	push   %ebp
  800d46:	89 e5                	mov    %esp,%ebp
  800d48:	53                   	push   %ebx
  800d49:	83 ec 10             	sub    $0x10,%esp
  800d4c:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  800d4f:	53                   	push   %ebx
  800d50:	e8 83 ff ff ff       	call   800cd8 <strlen>
  800d55:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  800d58:	ff 75 0c             	pushl  0xc(%ebp)
  800d5b:	01 d8                	add    %ebx,%eax
  800d5d:	50                   	push   %eax
  800d5e:	e8 b8 ff ff ff       	call   800d1b <strcpy>
	return dst;
}
  800d63:	89 d8                	mov    %ebx,%eax
  800d65:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800d68:	c9                   	leave  
  800d69:	c3                   	ret    

00800d6a <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  800d6a:	f3 0f 1e fb          	endbr32 
  800d6e:	55                   	push   %ebp
  800d6f:	89 e5                	mov    %esp,%ebp
  800d71:	56                   	push   %esi
  800d72:	53                   	push   %ebx
  800d73:	8b 75 08             	mov    0x8(%ebp),%esi
  800d76:	8b 55 0c             	mov    0xc(%ebp),%edx
  800d79:	89 f3                	mov    %esi,%ebx
  800d7b:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800d7e:	89 f0                	mov    %esi,%eax
  800d80:	39 d8                	cmp    %ebx,%eax
  800d82:	74 11                	je     800d95 <strncpy+0x2b>
		*dst++ = *src;
  800d84:	83 c0 01             	add    $0x1,%eax
  800d87:	0f b6 0a             	movzbl (%edx),%ecx
  800d8a:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800d8d:	80 f9 01             	cmp    $0x1,%cl
  800d90:	83 da ff             	sbb    $0xffffffff,%edx
  800d93:	eb eb                	jmp    800d80 <strncpy+0x16>
	}
	return ret;
}
  800d95:	89 f0                	mov    %esi,%eax
  800d97:	5b                   	pop    %ebx
  800d98:	5e                   	pop    %esi
  800d99:	5d                   	pop    %ebp
  800d9a:	c3                   	ret    

00800d9b <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800d9b:	f3 0f 1e fb          	endbr32 
  800d9f:	55                   	push   %ebp
  800da0:	89 e5                	mov    %esp,%ebp
  800da2:	56                   	push   %esi
  800da3:	53                   	push   %ebx
  800da4:	8b 75 08             	mov    0x8(%ebp),%esi
  800da7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800daa:	8b 55 10             	mov    0x10(%ebp),%edx
  800dad:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800daf:	85 d2                	test   %edx,%edx
  800db1:	74 21                	je     800dd4 <strlcpy+0x39>
  800db3:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  800db7:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  800db9:	39 c2                	cmp    %eax,%edx
  800dbb:	74 14                	je     800dd1 <strlcpy+0x36>
  800dbd:	0f b6 19             	movzbl (%ecx),%ebx
  800dc0:	84 db                	test   %bl,%bl
  800dc2:	74 0b                	je     800dcf <strlcpy+0x34>
			*dst++ = *src++;
  800dc4:	83 c1 01             	add    $0x1,%ecx
  800dc7:	83 c2 01             	add    $0x1,%edx
  800dca:	88 5a ff             	mov    %bl,-0x1(%edx)
  800dcd:	eb ea                	jmp    800db9 <strlcpy+0x1e>
  800dcf:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  800dd1:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  800dd4:	29 f0                	sub    %esi,%eax
}
  800dd6:	5b                   	pop    %ebx
  800dd7:	5e                   	pop    %esi
  800dd8:	5d                   	pop    %ebp
  800dd9:	c3                   	ret    

00800dda <strcmp>:

int
strcmp(const char *p, const char *q)
{
  800dda:	f3 0f 1e fb          	endbr32 
  800dde:	55                   	push   %ebp
  800ddf:	89 e5                	mov    %esp,%ebp
  800de1:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800de4:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  800de7:	0f b6 01             	movzbl (%ecx),%eax
  800dea:	84 c0                	test   %al,%al
  800dec:	74 0c                	je     800dfa <strcmp+0x20>
  800dee:	3a 02                	cmp    (%edx),%al
  800df0:	75 08                	jne    800dfa <strcmp+0x20>
		p++, q++;
  800df2:	83 c1 01             	add    $0x1,%ecx
  800df5:	83 c2 01             	add    $0x1,%edx
  800df8:	eb ed                	jmp    800de7 <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  800dfa:	0f b6 c0             	movzbl %al,%eax
  800dfd:	0f b6 12             	movzbl (%edx),%edx
  800e00:	29 d0                	sub    %edx,%eax
}
  800e02:	5d                   	pop    %ebp
  800e03:	c3                   	ret    

00800e04 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  800e04:	f3 0f 1e fb          	endbr32 
  800e08:	55                   	push   %ebp
  800e09:	89 e5                	mov    %esp,%ebp
  800e0b:	53                   	push   %ebx
  800e0c:	8b 45 08             	mov    0x8(%ebp),%eax
  800e0f:	8b 55 0c             	mov    0xc(%ebp),%edx
  800e12:	89 c3                	mov    %eax,%ebx
  800e14:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  800e17:	eb 06                	jmp    800e1f <strncmp+0x1b>
		n--, p++, q++;
  800e19:	83 c0 01             	add    $0x1,%eax
  800e1c:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800e1f:	39 d8                	cmp    %ebx,%eax
  800e21:	74 16                	je     800e39 <strncmp+0x35>
  800e23:	0f b6 08             	movzbl (%eax),%ecx
  800e26:	84 c9                	test   %cl,%cl
  800e28:	74 04                	je     800e2e <strncmp+0x2a>
  800e2a:	3a 0a                	cmp    (%edx),%cl
  800e2c:	74 eb                	je     800e19 <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800e2e:	0f b6 00             	movzbl (%eax),%eax
  800e31:	0f b6 12             	movzbl (%edx),%edx
  800e34:	29 d0                	sub    %edx,%eax
}
  800e36:	5b                   	pop    %ebx
  800e37:	5d                   	pop    %ebp
  800e38:	c3                   	ret    
		return 0;
  800e39:	b8 00 00 00 00       	mov    $0x0,%eax
  800e3e:	eb f6                	jmp    800e36 <strncmp+0x32>

00800e40 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800e40:	f3 0f 1e fb          	endbr32 
  800e44:	55                   	push   %ebp
  800e45:	89 e5                	mov    %esp,%ebp
  800e47:	8b 45 08             	mov    0x8(%ebp),%eax
  800e4a:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800e4e:	0f b6 10             	movzbl (%eax),%edx
  800e51:	84 d2                	test   %dl,%dl
  800e53:	74 09                	je     800e5e <strchr+0x1e>
		if (*s == c)
  800e55:	38 ca                	cmp    %cl,%dl
  800e57:	74 0a                	je     800e63 <strchr+0x23>
	for (; *s; s++)
  800e59:	83 c0 01             	add    $0x1,%eax
  800e5c:	eb f0                	jmp    800e4e <strchr+0xe>
			return (char *) s;
	return 0;
  800e5e:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800e63:	5d                   	pop    %ebp
  800e64:	c3                   	ret    

00800e65 <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800e65:	f3 0f 1e fb          	endbr32 
  800e69:	55                   	push   %ebp
  800e6a:	89 e5                	mov    %esp,%ebp
  800e6c:	8b 45 08             	mov    0x8(%ebp),%eax
  800e6f:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800e73:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800e76:	38 ca                	cmp    %cl,%dl
  800e78:	74 09                	je     800e83 <strfind+0x1e>
  800e7a:	84 d2                	test   %dl,%dl
  800e7c:	74 05                	je     800e83 <strfind+0x1e>
	for (; *s; s++)
  800e7e:	83 c0 01             	add    $0x1,%eax
  800e81:	eb f0                	jmp    800e73 <strfind+0xe>
			break;
	return (char *) s;
}
  800e83:	5d                   	pop    %ebp
  800e84:	c3                   	ret    

00800e85 <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800e85:	f3 0f 1e fb          	endbr32 
  800e89:	55                   	push   %ebp
  800e8a:	89 e5                	mov    %esp,%ebp
  800e8c:	57                   	push   %edi
  800e8d:	56                   	push   %esi
  800e8e:	53                   	push   %ebx
  800e8f:	8b 7d 08             	mov    0x8(%ebp),%edi
  800e92:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800e95:	85 c9                	test   %ecx,%ecx
  800e97:	74 31                	je     800eca <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800e99:	89 f8                	mov    %edi,%eax
  800e9b:	09 c8                	or     %ecx,%eax
  800e9d:	a8 03                	test   $0x3,%al
  800e9f:	75 23                	jne    800ec4 <memset+0x3f>
		c &= 0xFF;
  800ea1:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800ea5:	89 d3                	mov    %edx,%ebx
  800ea7:	c1 e3 08             	shl    $0x8,%ebx
  800eaa:	89 d0                	mov    %edx,%eax
  800eac:	c1 e0 18             	shl    $0x18,%eax
  800eaf:	89 d6                	mov    %edx,%esi
  800eb1:	c1 e6 10             	shl    $0x10,%esi
  800eb4:	09 f0                	or     %esi,%eax
  800eb6:	09 c2                	or     %eax,%edx
  800eb8:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800eba:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800ebd:	89 d0                	mov    %edx,%eax
  800ebf:	fc                   	cld    
  800ec0:	f3 ab                	rep stos %eax,%es:(%edi)
  800ec2:	eb 06                	jmp    800eca <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800ec4:	8b 45 0c             	mov    0xc(%ebp),%eax
  800ec7:	fc                   	cld    
  800ec8:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800eca:	89 f8                	mov    %edi,%eax
  800ecc:	5b                   	pop    %ebx
  800ecd:	5e                   	pop    %esi
  800ece:	5f                   	pop    %edi
  800ecf:	5d                   	pop    %ebp
  800ed0:	c3                   	ret    

00800ed1 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800ed1:	f3 0f 1e fb          	endbr32 
  800ed5:	55                   	push   %ebp
  800ed6:	89 e5                	mov    %esp,%ebp
  800ed8:	57                   	push   %edi
  800ed9:	56                   	push   %esi
  800eda:	8b 45 08             	mov    0x8(%ebp),%eax
  800edd:	8b 75 0c             	mov    0xc(%ebp),%esi
  800ee0:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800ee3:	39 c6                	cmp    %eax,%esi
  800ee5:	73 32                	jae    800f19 <memmove+0x48>
  800ee7:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800eea:	39 c2                	cmp    %eax,%edx
  800eec:	76 2b                	jbe    800f19 <memmove+0x48>
		s += n;
		d += n;
  800eee:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800ef1:	89 fe                	mov    %edi,%esi
  800ef3:	09 ce                	or     %ecx,%esi
  800ef5:	09 d6                	or     %edx,%esi
  800ef7:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800efd:	75 0e                	jne    800f0d <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800eff:	83 ef 04             	sub    $0x4,%edi
  800f02:	8d 72 fc             	lea    -0x4(%edx),%esi
  800f05:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800f08:	fd                   	std    
  800f09:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800f0b:	eb 09                	jmp    800f16 <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800f0d:	83 ef 01             	sub    $0x1,%edi
  800f10:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800f13:	fd                   	std    
  800f14:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800f16:	fc                   	cld    
  800f17:	eb 1a                	jmp    800f33 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800f19:	89 c2                	mov    %eax,%edx
  800f1b:	09 ca                	or     %ecx,%edx
  800f1d:	09 f2                	or     %esi,%edx
  800f1f:	f6 c2 03             	test   $0x3,%dl
  800f22:	75 0a                	jne    800f2e <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800f24:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800f27:	89 c7                	mov    %eax,%edi
  800f29:	fc                   	cld    
  800f2a:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800f2c:	eb 05                	jmp    800f33 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800f2e:	89 c7                	mov    %eax,%edi
  800f30:	fc                   	cld    
  800f31:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800f33:	5e                   	pop    %esi
  800f34:	5f                   	pop    %edi
  800f35:	5d                   	pop    %ebp
  800f36:	c3                   	ret    

00800f37 <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800f37:	f3 0f 1e fb          	endbr32 
  800f3b:	55                   	push   %ebp
  800f3c:	89 e5                	mov    %esp,%ebp
  800f3e:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800f41:	ff 75 10             	pushl  0x10(%ebp)
  800f44:	ff 75 0c             	pushl  0xc(%ebp)
  800f47:	ff 75 08             	pushl  0x8(%ebp)
  800f4a:	e8 82 ff ff ff       	call   800ed1 <memmove>
}
  800f4f:	c9                   	leave  
  800f50:	c3                   	ret    

00800f51 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800f51:	f3 0f 1e fb          	endbr32 
  800f55:	55                   	push   %ebp
  800f56:	89 e5                	mov    %esp,%ebp
  800f58:	56                   	push   %esi
  800f59:	53                   	push   %ebx
  800f5a:	8b 45 08             	mov    0x8(%ebp),%eax
  800f5d:	8b 55 0c             	mov    0xc(%ebp),%edx
  800f60:	89 c6                	mov    %eax,%esi
  800f62:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800f65:	39 f0                	cmp    %esi,%eax
  800f67:	74 1c                	je     800f85 <memcmp+0x34>
		if (*s1 != *s2)
  800f69:	0f b6 08             	movzbl (%eax),%ecx
  800f6c:	0f b6 1a             	movzbl (%edx),%ebx
  800f6f:	38 d9                	cmp    %bl,%cl
  800f71:	75 08                	jne    800f7b <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800f73:	83 c0 01             	add    $0x1,%eax
  800f76:	83 c2 01             	add    $0x1,%edx
  800f79:	eb ea                	jmp    800f65 <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800f7b:	0f b6 c1             	movzbl %cl,%eax
  800f7e:	0f b6 db             	movzbl %bl,%ebx
  800f81:	29 d8                	sub    %ebx,%eax
  800f83:	eb 05                	jmp    800f8a <memcmp+0x39>
	}

	return 0;
  800f85:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800f8a:	5b                   	pop    %ebx
  800f8b:	5e                   	pop    %esi
  800f8c:	5d                   	pop    %ebp
  800f8d:	c3                   	ret    

00800f8e <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800f8e:	f3 0f 1e fb          	endbr32 
  800f92:	55                   	push   %ebp
  800f93:	89 e5                	mov    %esp,%ebp
  800f95:	8b 45 08             	mov    0x8(%ebp),%eax
  800f98:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800f9b:	89 c2                	mov    %eax,%edx
  800f9d:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800fa0:	39 d0                	cmp    %edx,%eax
  800fa2:	73 09                	jae    800fad <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800fa4:	38 08                	cmp    %cl,(%eax)
  800fa6:	74 05                	je     800fad <memfind+0x1f>
	for (; s < ends; s++)
  800fa8:	83 c0 01             	add    $0x1,%eax
  800fab:	eb f3                	jmp    800fa0 <memfind+0x12>
			break;
	return (void *) s;
}
  800fad:	5d                   	pop    %ebp
  800fae:	c3                   	ret    

00800faf <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800faf:	f3 0f 1e fb          	endbr32 
  800fb3:	55                   	push   %ebp
  800fb4:	89 e5                	mov    %esp,%ebp
  800fb6:	57                   	push   %edi
  800fb7:	56                   	push   %esi
  800fb8:	53                   	push   %ebx
  800fb9:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800fbc:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800fbf:	eb 03                	jmp    800fc4 <strtol+0x15>
		s++;
  800fc1:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800fc4:	0f b6 01             	movzbl (%ecx),%eax
  800fc7:	3c 20                	cmp    $0x20,%al
  800fc9:	74 f6                	je     800fc1 <strtol+0x12>
  800fcb:	3c 09                	cmp    $0x9,%al
  800fcd:	74 f2                	je     800fc1 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800fcf:	3c 2b                	cmp    $0x2b,%al
  800fd1:	74 2a                	je     800ffd <strtol+0x4e>
	int neg = 0;
  800fd3:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800fd8:	3c 2d                	cmp    $0x2d,%al
  800fda:	74 2b                	je     801007 <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800fdc:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800fe2:	75 0f                	jne    800ff3 <strtol+0x44>
  800fe4:	80 39 30             	cmpb   $0x30,(%ecx)
  800fe7:	74 28                	je     801011 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800fe9:	85 db                	test   %ebx,%ebx
  800feb:	b8 0a 00 00 00       	mov    $0xa,%eax
  800ff0:	0f 44 d8             	cmove  %eax,%ebx
  800ff3:	b8 00 00 00 00       	mov    $0x0,%eax
  800ff8:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800ffb:	eb 46                	jmp    801043 <strtol+0x94>
		s++;
  800ffd:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  801000:	bf 00 00 00 00       	mov    $0x0,%edi
  801005:	eb d5                	jmp    800fdc <strtol+0x2d>
		s++, neg = 1;
  801007:	83 c1 01             	add    $0x1,%ecx
  80100a:	bf 01 00 00 00       	mov    $0x1,%edi
  80100f:	eb cb                	jmp    800fdc <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  801011:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  801015:	74 0e                	je     801025 <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  801017:	85 db                	test   %ebx,%ebx
  801019:	75 d8                	jne    800ff3 <strtol+0x44>
		s++, base = 8;
  80101b:	83 c1 01             	add    $0x1,%ecx
  80101e:	bb 08 00 00 00       	mov    $0x8,%ebx
  801023:	eb ce                	jmp    800ff3 <strtol+0x44>
		s += 2, base = 16;
  801025:	83 c1 02             	add    $0x2,%ecx
  801028:	bb 10 00 00 00       	mov    $0x10,%ebx
  80102d:	eb c4                	jmp    800ff3 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  80102f:	0f be d2             	movsbl %dl,%edx
  801032:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  801035:	3b 55 10             	cmp    0x10(%ebp),%edx
  801038:	7d 3a                	jge    801074 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  80103a:	83 c1 01             	add    $0x1,%ecx
  80103d:	0f af 45 10          	imul   0x10(%ebp),%eax
  801041:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  801043:	0f b6 11             	movzbl (%ecx),%edx
  801046:	8d 72 d0             	lea    -0x30(%edx),%esi
  801049:	89 f3                	mov    %esi,%ebx
  80104b:	80 fb 09             	cmp    $0x9,%bl
  80104e:	76 df                	jbe    80102f <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  801050:	8d 72 9f             	lea    -0x61(%edx),%esi
  801053:	89 f3                	mov    %esi,%ebx
  801055:	80 fb 19             	cmp    $0x19,%bl
  801058:	77 08                	ja     801062 <strtol+0xb3>
			dig = *s - 'a' + 10;
  80105a:	0f be d2             	movsbl %dl,%edx
  80105d:	83 ea 57             	sub    $0x57,%edx
  801060:	eb d3                	jmp    801035 <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  801062:	8d 72 bf             	lea    -0x41(%edx),%esi
  801065:	89 f3                	mov    %esi,%ebx
  801067:	80 fb 19             	cmp    $0x19,%bl
  80106a:	77 08                	ja     801074 <strtol+0xc5>
			dig = *s - 'A' + 10;
  80106c:	0f be d2             	movsbl %dl,%edx
  80106f:	83 ea 37             	sub    $0x37,%edx
  801072:	eb c1                	jmp    801035 <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  801074:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  801078:	74 05                	je     80107f <strtol+0xd0>
		*endptr = (char *) s;
  80107a:	8b 75 0c             	mov    0xc(%ebp),%esi
  80107d:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  80107f:	89 c2                	mov    %eax,%edx
  801081:	f7 da                	neg    %edx
  801083:	85 ff                	test   %edi,%edi
  801085:	0f 45 c2             	cmovne %edx,%eax
}
  801088:	5b                   	pop    %ebx
  801089:	5e                   	pop    %esi
  80108a:	5f                   	pop    %edi
  80108b:	5d                   	pop    %ebp
  80108c:	c3                   	ret    

0080108d <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  80108d:	f3 0f 1e fb          	endbr32 
  801091:	55                   	push   %ebp
  801092:	89 e5                	mov    %esp,%ebp
  801094:	57                   	push   %edi
  801095:	56                   	push   %esi
  801096:	53                   	push   %ebx
	asm volatile("int %1\n"
  801097:	b8 00 00 00 00       	mov    $0x0,%eax
  80109c:	8b 55 08             	mov    0x8(%ebp),%edx
  80109f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8010a2:	89 c3                	mov    %eax,%ebx
  8010a4:	89 c7                	mov    %eax,%edi
  8010a6:	89 c6                	mov    %eax,%esi
  8010a8:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  8010aa:	5b                   	pop    %ebx
  8010ab:	5e                   	pop    %esi
  8010ac:	5f                   	pop    %edi
  8010ad:	5d                   	pop    %ebp
  8010ae:	c3                   	ret    

008010af <sys_cgetc>:

int
sys_cgetc(void)
{
  8010af:	f3 0f 1e fb          	endbr32 
  8010b3:	55                   	push   %ebp
  8010b4:	89 e5                	mov    %esp,%ebp
  8010b6:	57                   	push   %edi
  8010b7:	56                   	push   %esi
  8010b8:	53                   	push   %ebx
	asm volatile("int %1\n"
  8010b9:	ba 00 00 00 00       	mov    $0x0,%edx
  8010be:	b8 01 00 00 00       	mov    $0x1,%eax
  8010c3:	89 d1                	mov    %edx,%ecx
  8010c5:	89 d3                	mov    %edx,%ebx
  8010c7:	89 d7                	mov    %edx,%edi
  8010c9:	89 d6                	mov    %edx,%esi
  8010cb:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  8010cd:	5b                   	pop    %ebx
  8010ce:	5e                   	pop    %esi
  8010cf:	5f                   	pop    %edi
  8010d0:	5d                   	pop    %ebp
  8010d1:	c3                   	ret    

008010d2 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  8010d2:	f3 0f 1e fb          	endbr32 
  8010d6:	55                   	push   %ebp
  8010d7:	89 e5                	mov    %esp,%ebp
  8010d9:	57                   	push   %edi
  8010da:	56                   	push   %esi
  8010db:	53                   	push   %ebx
  8010dc:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  8010df:	b9 00 00 00 00       	mov    $0x0,%ecx
  8010e4:	8b 55 08             	mov    0x8(%ebp),%edx
  8010e7:	b8 03 00 00 00       	mov    $0x3,%eax
  8010ec:	89 cb                	mov    %ecx,%ebx
  8010ee:	89 cf                	mov    %ecx,%edi
  8010f0:	89 ce                	mov    %ecx,%esi
  8010f2:	cd 30                	int    $0x30
	if(check && ret > 0)
  8010f4:	85 c0                	test   %eax,%eax
  8010f6:	7f 08                	jg     801100 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  8010f8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8010fb:	5b                   	pop    %ebx
  8010fc:	5e                   	pop    %esi
  8010fd:	5f                   	pop    %edi
  8010fe:	5d                   	pop    %ebp
  8010ff:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  801100:	83 ec 0c             	sub    $0xc,%esp
  801103:	50                   	push   %eax
  801104:	6a 03                	push   $0x3
  801106:	68 5f 29 80 00       	push   $0x80295f
  80110b:	6a 23                	push   $0x23
  80110d:	68 7c 29 80 00       	push   $0x80297c
  801112:	e8 44 f5 ff ff       	call   80065b <_panic>

00801117 <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  801117:	f3 0f 1e fb          	endbr32 
  80111b:	55                   	push   %ebp
  80111c:	89 e5                	mov    %esp,%ebp
  80111e:	57                   	push   %edi
  80111f:	56                   	push   %esi
  801120:	53                   	push   %ebx
	asm volatile("int %1\n"
  801121:	ba 00 00 00 00       	mov    $0x0,%edx
  801126:	b8 02 00 00 00       	mov    $0x2,%eax
  80112b:	89 d1                	mov    %edx,%ecx
  80112d:	89 d3                	mov    %edx,%ebx
  80112f:	89 d7                	mov    %edx,%edi
  801131:	89 d6                	mov    %edx,%esi
  801133:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  801135:	5b                   	pop    %ebx
  801136:	5e                   	pop    %esi
  801137:	5f                   	pop    %edi
  801138:	5d                   	pop    %ebp
  801139:	c3                   	ret    

0080113a <sys_yield>:

void
sys_yield(void)
{
  80113a:	f3 0f 1e fb          	endbr32 
  80113e:	55                   	push   %ebp
  80113f:	89 e5                	mov    %esp,%ebp
  801141:	57                   	push   %edi
  801142:	56                   	push   %esi
  801143:	53                   	push   %ebx
	asm volatile("int %1\n"
  801144:	ba 00 00 00 00       	mov    $0x0,%edx
  801149:	b8 0b 00 00 00       	mov    $0xb,%eax
  80114e:	89 d1                	mov    %edx,%ecx
  801150:	89 d3                	mov    %edx,%ebx
  801152:	89 d7                	mov    %edx,%edi
  801154:	89 d6                	mov    %edx,%esi
  801156:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  801158:	5b                   	pop    %ebx
  801159:	5e                   	pop    %esi
  80115a:	5f                   	pop    %edi
  80115b:	5d                   	pop    %ebp
  80115c:	c3                   	ret    

0080115d <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  80115d:	f3 0f 1e fb          	endbr32 
  801161:	55                   	push   %ebp
  801162:	89 e5                	mov    %esp,%ebp
  801164:	57                   	push   %edi
  801165:	56                   	push   %esi
  801166:	53                   	push   %ebx
  801167:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  80116a:	be 00 00 00 00       	mov    $0x0,%esi
  80116f:	8b 55 08             	mov    0x8(%ebp),%edx
  801172:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801175:	b8 04 00 00 00       	mov    $0x4,%eax
  80117a:	8b 5d 10             	mov    0x10(%ebp),%ebx
  80117d:	89 f7                	mov    %esi,%edi
  80117f:	cd 30                	int    $0x30
	if(check && ret > 0)
  801181:	85 c0                	test   %eax,%eax
  801183:	7f 08                	jg     80118d <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  801185:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801188:	5b                   	pop    %ebx
  801189:	5e                   	pop    %esi
  80118a:	5f                   	pop    %edi
  80118b:	5d                   	pop    %ebp
  80118c:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  80118d:	83 ec 0c             	sub    $0xc,%esp
  801190:	50                   	push   %eax
  801191:	6a 04                	push   $0x4
  801193:	68 5f 29 80 00       	push   $0x80295f
  801198:	6a 23                	push   $0x23
  80119a:	68 7c 29 80 00       	push   $0x80297c
  80119f:	e8 b7 f4 ff ff       	call   80065b <_panic>

008011a4 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  8011a4:	f3 0f 1e fb          	endbr32 
  8011a8:	55                   	push   %ebp
  8011a9:	89 e5                	mov    %esp,%ebp
  8011ab:	57                   	push   %edi
  8011ac:	56                   	push   %esi
  8011ad:	53                   	push   %ebx
  8011ae:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  8011b1:	8b 55 08             	mov    0x8(%ebp),%edx
  8011b4:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8011b7:	b8 05 00 00 00       	mov    $0x5,%eax
  8011bc:	8b 5d 10             	mov    0x10(%ebp),%ebx
  8011bf:	8b 7d 14             	mov    0x14(%ebp),%edi
  8011c2:	8b 75 18             	mov    0x18(%ebp),%esi
  8011c5:	cd 30                	int    $0x30
	if(check && ret > 0)
  8011c7:	85 c0                	test   %eax,%eax
  8011c9:	7f 08                	jg     8011d3 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  8011cb:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8011ce:	5b                   	pop    %ebx
  8011cf:	5e                   	pop    %esi
  8011d0:	5f                   	pop    %edi
  8011d1:	5d                   	pop    %ebp
  8011d2:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8011d3:	83 ec 0c             	sub    $0xc,%esp
  8011d6:	50                   	push   %eax
  8011d7:	6a 05                	push   $0x5
  8011d9:	68 5f 29 80 00       	push   $0x80295f
  8011de:	6a 23                	push   $0x23
  8011e0:	68 7c 29 80 00       	push   $0x80297c
  8011e5:	e8 71 f4 ff ff       	call   80065b <_panic>

008011ea <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  8011ea:	f3 0f 1e fb          	endbr32 
  8011ee:	55                   	push   %ebp
  8011ef:	89 e5                	mov    %esp,%ebp
  8011f1:	57                   	push   %edi
  8011f2:	56                   	push   %esi
  8011f3:	53                   	push   %ebx
  8011f4:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  8011f7:	bb 00 00 00 00       	mov    $0x0,%ebx
  8011fc:	8b 55 08             	mov    0x8(%ebp),%edx
  8011ff:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801202:	b8 06 00 00 00       	mov    $0x6,%eax
  801207:	89 df                	mov    %ebx,%edi
  801209:	89 de                	mov    %ebx,%esi
  80120b:	cd 30                	int    $0x30
	if(check && ret > 0)
  80120d:	85 c0                	test   %eax,%eax
  80120f:	7f 08                	jg     801219 <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  801211:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801214:	5b                   	pop    %ebx
  801215:	5e                   	pop    %esi
  801216:	5f                   	pop    %edi
  801217:	5d                   	pop    %ebp
  801218:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  801219:	83 ec 0c             	sub    $0xc,%esp
  80121c:	50                   	push   %eax
  80121d:	6a 06                	push   $0x6
  80121f:	68 5f 29 80 00       	push   $0x80295f
  801224:	6a 23                	push   $0x23
  801226:	68 7c 29 80 00       	push   $0x80297c
  80122b:	e8 2b f4 ff ff       	call   80065b <_panic>

00801230 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  801230:	f3 0f 1e fb          	endbr32 
  801234:	55                   	push   %ebp
  801235:	89 e5                	mov    %esp,%ebp
  801237:	57                   	push   %edi
  801238:	56                   	push   %esi
  801239:	53                   	push   %ebx
  80123a:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  80123d:	bb 00 00 00 00       	mov    $0x0,%ebx
  801242:	8b 55 08             	mov    0x8(%ebp),%edx
  801245:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801248:	b8 08 00 00 00       	mov    $0x8,%eax
  80124d:	89 df                	mov    %ebx,%edi
  80124f:	89 de                	mov    %ebx,%esi
  801251:	cd 30                	int    $0x30
	if(check && ret > 0)
  801253:	85 c0                	test   %eax,%eax
  801255:	7f 08                	jg     80125f <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  801257:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80125a:	5b                   	pop    %ebx
  80125b:	5e                   	pop    %esi
  80125c:	5f                   	pop    %edi
  80125d:	5d                   	pop    %ebp
  80125e:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  80125f:	83 ec 0c             	sub    $0xc,%esp
  801262:	50                   	push   %eax
  801263:	6a 08                	push   $0x8
  801265:	68 5f 29 80 00       	push   $0x80295f
  80126a:	6a 23                	push   $0x23
  80126c:	68 7c 29 80 00       	push   $0x80297c
  801271:	e8 e5 f3 ff ff       	call   80065b <_panic>

00801276 <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  801276:	f3 0f 1e fb          	endbr32 
  80127a:	55                   	push   %ebp
  80127b:	89 e5                	mov    %esp,%ebp
  80127d:	57                   	push   %edi
  80127e:	56                   	push   %esi
  80127f:	53                   	push   %ebx
  801280:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  801283:	bb 00 00 00 00       	mov    $0x0,%ebx
  801288:	8b 55 08             	mov    0x8(%ebp),%edx
  80128b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80128e:	b8 09 00 00 00       	mov    $0x9,%eax
  801293:	89 df                	mov    %ebx,%edi
  801295:	89 de                	mov    %ebx,%esi
  801297:	cd 30                	int    $0x30
	if(check && ret > 0)
  801299:	85 c0                	test   %eax,%eax
  80129b:	7f 08                	jg     8012a5 <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  80129d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8012a0:	5b                   	pop    %ebx
  8012a1:	5e                   	pop    %esi
  8012a2:	5f                   	pop    %edi
  8012a3:	5d                   	pop    %ebp
  8012a4:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8012a5:	83 ec 0c             	sub    $0xc,%esp
  8012a8:	50                   	push   %eax
  8012a9:	6a 09                	push   $0x9
  8012ab:	68 5f 29 80 00       	push   $0x80295f
  8012b0:	6a 23                	push   $0x23
  8012b2:	68 7c 29 80 00       	push   $0x80297c
  8012b7:	e8 9f f3 ff ff       	call   80065b <_panic>

008012bc <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  8012bc:	f3 0f 1e fb          	endbr32 
  8012c0:	55                   	push   %ebp
  8012c1:	89 e5                	mov    %esp,%ebp
  8012c3:	57                   	push   %edi
  8012c4:	56                   	push   %esi
  8012c5:	53                   	push   %ebx
  8012c6:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  8012c9:	bb 00 00 00 00       	mov    $0x0,%ebx
  8012ce:	8b 55 08             	mov    0x8(%ebp),%edx
  8012d1:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8012d4:	b8 0a 00 00 00       	mov    $0xa,%eax
  8012d9:	89 df                	mov    %ebx,%edi
  8012db:	89 de                	mov    %ebx,%esi
  8012dd:	cd 30                	int    $0x30
	if(check && ret > 0)
  8012df:	85 c0                	test   %eax,%eax
  8012e1:	7f 08                	jg     8012eb <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  8012e3:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8012e6:	5b                   	pop    %ebx
  8012e7:	5e                   	pop    %esi
  8012e8:	5f                   	pop    %edi
  8012e9:	5d                   	pop    %ebp
  8012ea:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8012eb:	83 ec 0c             	sub    $0xc,%esp
  8012ee:	50                   	push   %eax
  8012ef:	6a 0a                	push   $0xa
  8012f1:	68 5f 29 80 00       	push   $0x80295f
  8012f6:	6a 23                	push   $0x23
  8012f8:	68 7c 29 80 00       	push   $0x80297c
  8012fd:	e8 59 f3 ff ff       	call   80065b <_panic>

00801302 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  801302:	f3 0f 1e fb          	endbr32 
  801306:	55                   	push   %ebp
  801307:	89 e5                	mov    %esp,%ebp
  801309:	57                   	push   %edi
  80130a:	56                   	push   %esi
  80130b:	53                   	push   %ebx
	asm volatile("int %1\n"
  80130c:	8b 55 08             	mov    0x8(%ebp),%edx
  80130f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801312:	b8 0c 00 00 00       	mov    $0xc,%eax
  801317:	be 00 00 00 00       	mov    $0x0,%esi
  80131c:	8b 5d 10             	mov    0x10(%ebp),%ebx
  80131f:	8b 7d 14             	mov    0x14(%ebp),%edi
  801322:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  801324:	5b                   	pop    %ebx
  801325:	5e                   	pop    %esi
  801326:	5f                   	pop    %edi
  801327:	5d                   	pop    %ebp
  801328:	c3                   	ret    

00801329 <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  801329:	f3 0f 1e fb          	endbr32 
  80132d:	55                   	push   %ebp
  80132e:	89 e5                	mov    %esp,%ebp
  801330:	57                   	push   %edi
  801331:	56                   	push   %esi
  801332:	53                   	push   %ebx
  801333:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  801336:	b9 00 00 00 00       	mov    $0x0,%ecx
  80133b:	8b 55 08             	mov    0x8(%ebp),%edx
  80133e:	b8 0d 00 00 00       	mov    $0xd,%eax
  801343:	89 cb                	mov    %ecx,%ebx
  801345:	89 cf                	mov    %ecx,%edi
  801347:	89 ce                	mov    %ecx,%esi
  801349:	cd 30                	int    $0x30
	if(check && ret > 0)
  80134b:	85 c0                	test   %eax,%eax
  80134d:	7f 08                	jg     801357 <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  80134f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801352:	5b                   	pop    %ebx
  801353:	5e                   	pop    %esi
  801354:	5f                   	pop    %edi
  801355:	5d                   	pop    %ebp
  801356:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  801357:	83 ec 0c             	sub    $0xc,%esp
  80135a:	50                   	push   %eax
  80135b:	6a 0d                	push   $0xd
  80135d:	68 5f 29 80 00       	push   $0x80295f
  801362:	6a 23                	push   $0x23
  801364:	68 7c 29 80 00       	push   $0x80297c
  801369:	e8 ed f2 ff ff       	call   80065b <_panic>

0080136e <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  80136e:	f3 0f 1e fb          	endbr32 
  801372:	55                   	push   %ebp
  801373:	89 e5                	mov    %esp,%ebp
  801375:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  801378:	83 3d b4 40 80 00 00 	cmpl   $0x0,0x8040b4
  80137f:	74 27                	je     8013a8 <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  801381:	8b 45 08             	mov    0x8(%ebp),%eax
  801384:	a3 b4 40 80 00       	mov    %eax,0x8040b4
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  801389:	a1 b0 40 80 00       	mov    0x8040b0,%eax
  80138e:	8b 40 48             	mov    0x48(%eax),%eax
  801391:	83 ec 08             	sub    $0x8,%esp
  801394:	68 e8 13 80 00       	push   $0x8013e8
  801399:	50                   	push   %eax
  80139a:	e8 1d ff ff ff       	call   8012bc <sys_env_set_pgfault_upcall>
  80139f:	83 c4 10             	add    $0x10,%esp
  8013a2:	85 c0                	test   %eax,%eax
  8013a4:	78 2e                	js     8013d4 <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  8013a6:	c9                   	leave  
  8013a7:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  8013a8:	83 ec 04             	sub    $0x4,%esp
  8013ab:	6a 07                	push   $0x7
  8013ad:	68 00 f0 bf ee       	push   $0xeebff000
  8013b2:	6a 00                	push   $0x0
  8013b4:	e8 a4 fd ff ff       	call   80115d <sys_page_alloc>
  8013b9:	83 c4 10             	add    $0x10,%esp
  8013bc:	85 c0                	test   %eax,%eax
  8013be:	79 c1                	jns    801381 <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  8013c0:	83 ec 04             	sub    $0x4,%esp
  8013c3:	68 8c 29 80 00       	push   $0x80298c
  8013c8:	6a 21                	push   $0x21
  8013ca:	68 ee 29 80 00       	push   $0x8029ee
  8013cf:	e8 87 f2 ff ff       	call   80065b <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  8013d4:	83 ec 04             	sub    $0x4,%esp
  8013d7:	68 b8 29 80 00       	push   $0x8029b8
  8013dc:	6a 27                	push   $0x27
  8013de:	68 ee 29 80 00       	push   $0x8029ee
  8013e3:	e8 73 f2 ff ff       	call   80065b <_panic>

008013e8 <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  8013e8:	54                   	push   %esp
	movl _pgfault_handler, %eax
  8013e9:	a1 b4 40 80 00       	mov    0x8040b4,%eax
	call *%eax
  8013ee:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  8013f0:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  8013f3:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  8013f7:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  8013fa:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  8013fe:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  801402:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  801405:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  801408:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  801409:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  80140c:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  80140d:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  80140e:	c3                   	ret    

0080140f <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  80140f:	f3 0f 1e fb          	endbr32 
  801413:	55                   	push   %ebp
  801414:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801416:	8b 45 08             	mov    0x8(%ebp),%eax
  801419:	05 00 00 00 30       	add    $0x30000000,%eax
  80141e:	c1 e8 0c             	shr    $0xc,%eax
}
  801421:	5d                   	pop    %ebp
  801422:	c3                   	ret    

00801423 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  801423:	f3 0f 1e fb          	endbr32 
  801427:	55                   	push   %ebp
  801428:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  80142a:	8b 45 08             	mov    0x8(%ebp),%eax
  80142d:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  801432:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  801437:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  80143c:	5d                   	pop    %ebp
  80143d:	c3                   	ret    

0080143e <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  80143e:	f3 0f 1e fb          	endbr32 
  801442:	55                   	push   %ebp
  801443:	89 e5                	mov    %esp,%ebp
  801445:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  80144a:	89 c2                	mov    %eax,%edx
  80144c:	c1 ea 16             	shr    $0x16,%edx
  80144f:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  801456:	f6 c2 01             	test   $0x1,%dl
  801459:	74 2d                	je     801488 <fd_alloc+0x4a>
  80145b:	89 c2                	mov    %eax,%edx
  80145d:	c1 ea 0c             	shr    $0xc,%edx
  801460:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801467:	f6 c2 01             	test   $0x1,%dl
  80146a:	74 1c                	je     801488 <fd_alloc+0x4a>
  80146c:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  801471:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  801476:	75 d2                	jne    80144a <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  801478:	8b 45 08             	mov    0x8(%ebp),%eax
  80147b:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  801481:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  801486:	eb 0a                	jmp    801492 <fd_alloc+0x54>
			*fd_store = fd;
  801488:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80148b:	89 01                	mov    %eax,(%ecx)
			return 0;
  80148d:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801492:	5d                   	pop    %ebp
  801493:	c3                   	ret    

00801494 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  801494:	f3 0f 1e fb          	endbr32 
  801498:	55                   	push   %ebp
  801499:	89 e5                	mov    %esp,%ebp
  80149b:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  80149e:	83 f8 1f             	cmp    $0x1f,%eax
  8014a1:	77 30                	ja     8014d3 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  8014a3:	c1 e0 0c             	shl    $0xc,%eax
  8014a6:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  8014ab:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  8014b1:	f6 c2 01             	test   $0x1,%dl
  8014b4:	74 24                	je     8014da <fd_lookup+0x46>
  8014b6:	89 c2                	mov    %eax,%edx
  8014b8:	c1 ea 0c             	shr    $0xc,%edx
  8014bb:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  8014c2:	f6 c2 01             	test   $0x1,%dl
  8014c5:	74 1a                	je     8014e1 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  8014c7:	8b 55 0c             	mov    0xc(%ebp),%edx
  8014ca:	89 02                	mov    %eax,(%edx)
	return 0;
  8014cc:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8014d1:	5d                   	pop    %ebp
  8014d2:	c3                   	ret    
		return -E_INVAL;
  8014d3:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8014d8:	eb f7                	jmp    8014d1 <fd_lookup+0x3d>
		return -E_INVAL;
  8014da:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8014df:	eb f0                	jmp    8014d1 <fd_lookup+0x3d>
  8014e1:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8014e6:	eb e9                	jmp    8014d1 <fd_lookup+0x3d>

008014e8 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  8014e8:	f3 0f 1e fb          	endbr32 
  8014ec:	55                   	push   %ebp
  8014ed:	89 e5                	mov    %esp,%ebp
  8014ef:	83 ec 08             	sub    $0x8,%esp
  8014f2:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8014f5:	ba 78 2a 80 00       	mov    $0x802a78,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  8014fa:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  8014ff:	39 08                	cmp    %ecx,(%eax)
  801501:	74 33                	je     801536 <dev_lookup+0x4e>
  801503:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  801506:	8b 02                	mov    (%edx),%eax
  801508:	85 c0                	test   %eax,%eax
  80150a:	75 f3                	jne    8014ff <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  80150c:	a1 b0 40 80 00       	mov    0x8040b0,%eax
  801511:	8b 40 48             	mov    0x48(%eax),%eax
  801514:	83 ec 04             	sub    $0x4,%esp
  801517:	51                   	push   %ecx
  801518:	50                   	push   %eax
  801519:	68 fc 29 80 00       	push   $0x8029fc
  80151e:	e8 1f f2 ff ff       	call   800742 <cprintf>
	*dev = 0;
  801523:	8b 45 0c             	mov    0xc(%ebp),%eax
  801526:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  80152c:	83 c4 10             	add    $0x10,%esp
  80152f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  801534:	c9                   	leave  
  801535:	c3                   	ret    
			*dev = devtab[i];
  801536:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801539:	89 01                	mov    %eax,(%ecx)
			return 0;
  80153b:	b8 00 00 00 00       	mov    $0x0,%eax
  801540:	eb f2                	jmp    801534 <dev_lookup+0x4c>

00801542 <fd_close>:
{
  801542:	f3 0f 1e fb          	endbr32 
  801546:	55                   	push   %ebp
  801547:	89 e5                	mov    %esp,%ebp
  801549:	57                   	push   %edi
  80154a:	56                   	push   %esi
  80154b:	53                   	push   %ebx
  80154c:	83 ec 24             	sub    $0x24,%esp
  80154f:	8b 75 08             	mov    0x8(%ebp),%esi
  801552:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801555:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801558:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801559:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  80155f:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801562:	50                   	push   %eax
  801563:	e8 2c ff ff ff       	call   801494 <fd_lookup>
  801568:	89 c3                	mov    %eax,%ebx
  80156a:	83 c4 10             	add    $0x10,%esp
  80156d:	85 c0                	test   %eax,%eax
  80156f:	78 05                	js     801576 <fd_close+0x34>
	    || fd != fd2)
  801571:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  801574:	74 16                	je     80158c <fd_close+0x4a>
		return (must_exist ? r : 0);
  801576:	89 f8                	mov    %edi,%eax
  801578:	84 c0                	test   %al,%al
  80157a:	b8 00 00 00 00       	mov    $0x0,%eax
  80157f:	0f 44 d8             	cmove  %eax,%ebx
}
  801582:	89 d8                	mov    %ebx,%eax
  801584:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801587:	5b                   	pop    %ebx
  801588:	5e                   	pop    %esi
  801589:	5f                   	pop    %edi
  80158a:	5d                   	pop    %ebp
  80158b:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  80158c:	83 ec 08             	sub    $0x8,%esp
  80158f:	8d 45 e0             	lea    -0x20(%ebp),%eax
  801592:	50                   	push   %eax
  801593:	ff 36                	pushl  (%esi)
  801595:	e8 4e ff ff ff       	call   8014e8 <dev_lookup>
  80159a:	89 c3                	mov    %eax,%ebx
  80159c:	83 c4 10             	add    $0x10,%esp
  80159f:	85 c0                	test   %eax,%eax
  8015a1:	78 1a                	js     8015bd <fd_close+0x7b>
		if (dev->dev_close)
  8015a3:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8015a6:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  8015a9:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  8015ae:	85 c0                	test   %eax,%eax
  8015b0:	74 0b                	je     8015bd <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  8015b2:	83 ec 0c             	sub    $0xc,%esp
  8015b5:	56                   	push   %esi
  8015b6:	ff d0                	call   *%eax
  8015b8:	89 c3                	mov    %eax,%ebx
  8015ba:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  8015bd:	83 ec 08             	sub    $0x8,%esp
  8015c0:	56                   	push   %esi
  8015c1:	6a 00                	push   $0x0
  8015c3:	e8 22 fc ff ff       	call   8011ea <sys_page_unmap>
	return r;
  8015c8:	83 c4 10             	add    $0x10,%esp
  8015cb:	eb b5                	jmp    801582 <fd_close+0x40>

008015cd <close>:

int
close(int fdnum)
{
  8015cd:	f3 0f 1e fb          	endbr32 
  8015d1:	55                   	push   %ebp
  8015d2:	89 e5                	mov    %esp,%ebp
  8015d4:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8015d7:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8015da:	50                   	push   %eax
  8015db:	ff 75 08             	pushl  0x8(%ebp)
  8015de:	e8 b1 fe ff ff       	call   801494 <fd_lookup>
  8015e3:	83 c4 10             	add    $0x10,%esp
  8015e6:	85 c0                	test   %eax,%eax
  8015e8:	79 02                	jns    8015ec <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  8015ea:	c9                   	leave  
  8015eb:	c3                   	ret    
		return fd_close(fd, 1);
  8015ec:	83 ec 08             	sub    $0x8,%esp
  8015ef:	6a 01                	push   $0x1
  8015f1:	ff 75 f4             	pushl  -0xc(%ebp)
  8015f4:	e8 49 ff ff ff       	call   801542 <fd_close>
  8015f9:	83 c4 10             	add    $0x10,%esp
  8015fc:	eb ec                	jmp    8015ea <close+0x1d>

008015fe <close_all>:

void
close_all(void)
{
  8015fe:	f3 0f 1e fb          	endbr32 
  801602:	55                   	push   %ebp
  801603:	89 e5                	mov    %esp,%ebp
  801605:	53                   	push   %ebx
  801606:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  801609:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  80160e:	83 ec 0c             	sub    $0xc,%esp
  801611:	53                   	push   %ebx
  801612:	e8 b6 ff ff ff       	call   8015cd <close>
	for (i = 0; i < MAXFD; i++)
  801617:	83 c3 01             	add    $0x1,%ebx
  80161a:	83 c4 10             	add    $0x10,%esp
  80161d:	83 fb 20             	cmp    $0x20,%ebx
  801620:	75 ec                	jne    80160e <close_all+0x10>
}
  801622:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801625:	c9                   	leave  
  801626:	c3                   	ret    

00801627 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  801627:	f3 0f 1e fb          	endbr32 
  80162b:	55                   	push   %ebp
  80162c:	89 e5                	mov    %esp,%ebp
  80162e:	57                   	push   %edi
  80162f:	56                   	push   %esi
  801630:	53                   	push   %ebx
  801631:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  801634:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801637:	50                   	push   %eax
  801638:	ff 75 08             	pushl  0x8(%ebp)
  80163b:	e8 54 fe ff ff       	call   801494 <fd_lookup>
  801640:	89 c3                	mov    %eax,%ebx
  801642:	83 c4 10             	add    $0x10,%esp
  801645:	85 c0                	test   %eax,%eax
  801647:	0f 88 81 00 00 00    	js     8016ce <dup+0xa7>
		return r;
	close(newfdnum);
  80164d:	83 ec 0c             	sub    $0xc,%esp
  801650:	ff 75 0c             	pushl  0xc(%ebp)
  801653:	e8 75 ff ff ff       	call   8015cd <close>

	newfd = INDEX2FD(newfdnum);
  801658:	8b 75 0c             	mov    0xc(%ebp),%esi
  80165b:	c1 e6 0c             	shl    $0xc,%esi
  80165e:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  801664:	83 c4 04             	add    $0x4,%esp
  801667:	ff 75 e4             	pushl  -0x1c(%ebp)
  80166a:	e8 b4 fd ff ff       	call   801423 <fd2data>
  80166f:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  801671:	89 34 24             	mov    %esi,(%esp)
  801674:	e8 aa fd ff ff       	call   801423 <fd2data>
  801679:	83 c4 10             	add    $0x10,%esp
  80167c:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  80167e:	89 d8                	mov    %ebx,%eax
  801680:	c1 e8 16             	shr    $0x16,%eax
  801683:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  80168a:	a8 01                	test   $0x1,%al
  80168c:	74 11                	je     80169f <dup+0x78>
  80168e:	89 d8                	mov    %ebx,%eax
  801690:	c1 e8 0c             	shr    $0xc,%eax
  801693:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  80169a:	f6 c2 01             	test   $0x1,%dl
  80169d:	75 39                	jne    8016d8 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  80169f:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8016a2:	89 d0                	mov    %edx,%eax
  8016a4:	c1 e8 0c             	shr    $0xc,%eax
  8016a7:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8016ae:	83 ec 0c             	sub    $0xc,%esp
  8016b1:	25 07 0e 00 00       	and    $0xe07,%eax
  8016b6:	50                   	push   %eax
  8016b7:	56                   	push   %esi
  8016b8:	6a 00                	push   $0x0
  8016ba:	52                   	push   %edx
  8016bb:	6a 00                	push   $0x0
  8016bd:	e8 e2 fa ff ff       	call   8011a4 <sys_page_map>
  8016c2:	89 c3                	mov    %eax,%ebx
  8016c4:	83 c4 20             	add    $0x20,%esp
  8016c7:	85 c0                	test   %eax,%eax
  8016c9:	78 31                	js     8016fc <dup+0xd5>
		goto err;

	return newfdnum;
  8016cb:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  8016ce:	89 d8                	mov    %ebx,%eax
  8016d0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8016d3:	5b                   	pop    %ebx
  8016d4:	5e                   	pop    %esi
  8016d5:	5f                   	pop    %edi
  8016d6:	5d                   	pop    %ebp
  8016d7:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  8016d8:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8016df:	83 ec 0c             	sub    $0xc,%esp
  8016e2:	25 07 0e 00 00       	and    $0xe07,%eax
  8016e7:	50                   	push   %eax
  8016e8:	57                   	push   %edi
  8016e9:	6a 00                	push   $0x0
  8016eb:	53                   	push   %ebx
  8016ec:	6a 00                	push   $0x0
  8016ee:	e8 b1 fa ff ff       	call   8011a4 <sys_page_map>
  8016f3:	89 c3                	mov    %eax,%ebx
  8016f5:	83 c4 20             	add    $0x20,%esp
  8016f8:	85 c0                	test   %eax,%eax
  8016fa:	79 a3                	jns    80169f <dup+0x78>
	sys_page_unmap(0, newfd);
  8016fc:	83 ec 08             	sub    $0x8,%esp
  8016ff:	56                   	push   %esi
  801700:	6a 00                	push   $0x0
  801702:	e8 e3 fa ff ff       	call   8011ea <sys_page_unmap>
	sys_page_unmap(0, nva);
  801707:	83 c4 08             	add    $0x8,%esp
  80170a:	57                   	push   %edi
  80170b:	6a 00                	push   $0x0
  80170d:	e8 d8 fa ff ff       	call   8011ea <sys_page_unmap>
	return r;
  801712:	83 c4 10             	add    $0x10,%esp
  801715:	eb b7                	jmp    8016ce <dup+0xa7>

00801717 <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  801717:	f3 0f 1e fb          	endbr32 
  80171b:	55                   	push   %ebp
  80171c:	89 e5                	mov    %esp,%ebp
  80171e:	53                   	push   %ebx
  80171f:	83 ec 1c             	sub    $0x1c,%esp
  801722:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801725:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801728:	50                   	push   %eax
  801729:	53                   	push   %ebx
  80172a:	e8 65 fd ff ff       	call   801494 <fd_lookup>
  80172f:	83 c4 10             	add    $0x10,%esp
  801732:	85 c0                	test   %eax,%eax
  801734:	78 3f                	js     801775 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801736:	83 ec 08             	sub    $0x8,%esp
  801739:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80173c:	50                   	push   %eax
  80173d:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801740:	ff 30                	pushl  (%eax)
  801742:	e8 a1 fd ff ff       	call   8014e8 <dev_lookup>
  801747:	83 c4 10             	add    $0x10,%esp
  80174a:	85 c0                	test   %eax,%eax
  80174c:	78 27                	js     801775 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  80174e:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801751:	8b 42 08             	mov    0x8(%edx),%eax
  801754:	83 e0 03             	and    $0x3,%eax
  801757:	83 f8 01             	cmp    $0x1,%eax
  80175a:	74 1e                	je     80177a <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  80175c:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80175f:	8b 40 08             	mov    0x8(%eax),%eax
  801762:	85 c0                	test   %eax,%eax
  801764:	74 35                	je     80179b <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  801766:	83 ec 04             	sub    $0x4,%esp
  801769:	ff 75 10             	pushl  0x10(%ebp)
  80176c:	ff 75 0c             	pushl  0xc(%ebp)
  80176f:	52                   	push   %edx
  801770:	ff d0                	call   *%eax
  801772:	83 c4 10             	add    $0x10,%esp
}
  801775:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801778:	c9                   	leave  
  801779:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  80177a:	a1 b0 40 80 00       	mov    0x8040b0,%eax
  80177f:	8b 40 48             	mov    0x48(%eax),%eax
  801782:	83 ec 04             	sub    $0x4,%esp
  801785:	53                   	push   %ebx
  801786:	50                   	push   %eax
  801787:	68 3d 2a 80 00       	push   $0x802a3d
  80178c:	e8 b1 ef ff ff       	call   800742 <cprintf>
		return -E_INVAL;
  801791:	83 c4 10             	add    $0x10,%esp
  801794:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801799:	eb da                	jmp    801775 <read+0x5e>
		return -E_NOT_SUPP;
  80179b:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8017a0:	eb d3                	jmp    801775 <read+0x5e>

008017a2 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  8017a2:	f3 0f 1e fb          	endbr32 
  8017a6:	55                   	push   %ebp
  8017a7:	89 e5                	mov    %esp,%ebp
  8017a9:	57                   	push   %edi
  8017aa:	56                   	push   %esi
  8017ab:	53                   	push   %ebx
  8017ac:	83 ec 0c             	sub    $0xc,%esp
  8017af:	8b 7d 08             	mov    0x8(%ebp),%edi
  8017b2:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  8017b5:	bb 00 00 00 00       	mov    $0x0,%ebx
  8017ba:	eb 02                	jmp    8017be <readn+0x1c>
  8017bc:	01 c3                	add    %eax,%ebx
  8017be:	39 f3                	cmp    %esi,%ebx
  8017c0:	73 21                	jae    8017e3 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8017c2:	83 ec 04             	sub    $0x4,%esp
  8017c5:	89 f0                	mov    %esi,%eax
  8017c7:	29 d8                	sub    %ebx,%eax
  8017c9:	50                   	push   %eax
  8017ca:	89 d8                	mov    %ebx,%eax
  8017cc:	03 45 0c             	add    0xc(%ebp),%eax
  8017cf:	50                   	push   %eax
  8017d0:	57                   	push   %edi
  8017d1:	e8 41 ff ff ff       	call   801717 <read>
		if (m < 0)
  8017d6:	83 c4 10             	add    $0x10,%esp
  8017d9:	85 c0                	test   %eax,%eax
  8017db:	78 04                	js     8017e1 <readn+0x3f>
			return m;
		if (m == 0)
  8017dd:	75 dd                	jne    8017bc <readn+0x1a>
  8017df:	eb 02                	jmp    8017e3 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8017e1:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  8017e3:	89 d8                	mov    %ebx,%eax
  8017e5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8017e8:	5b                   	pop    %ebx
  8017e9:	5e                   	pop    %esi
  8017ea:	5f                   	pop    %edi
  8017eb:	5d                   	pop    %ebp
  8017ec:	c3                   	ret    

008017ed <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  8017ed:	f3 0f 1e fb          	endbr32 
  8017f1:	55                   	push   %ebp
  8017f2:	89 e5                	mov    %esp,%ebp
  8017f4:	53                   	push   %ebx
  8017f5:	83 ec 1c             	sub    $0x1c,%esp
  8017f8:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8017fb:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8017fe:	50                   	push   %eax
  8017ff:	53                   	push   %ebx
  801800:	e8 8f fc ff ff       	call   801494 <fd_lookup>
  801805:	83 c4 10             	add    $0x10,%esp
  801808:	85 c0                	test   %eax,%eax
  80180a:	78 3a                	js     801846 <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80180c:	83 ec 08             	sub    $0x8,%esp
  80180f:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801812:	50                   	push   %eax
  801813:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801816:	ff 30                	pushl  (%eax)
  801818:	e8 cb fc ff ff       	call   8014e8 <dev_lookup>
  80181d:	83 c4 10             	add    $0x10,%esp
  801820:	85 c0                	test   %eax,%eax
  801822:	78 22                	js     801846 <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801824:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801827:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  80182b:	74 1e                	je     80184b <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  80182d:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801830:	8b 52 0c             	mov    0xc(%edx),%edx
  801833:	85 d2                	test   %edx,%edx
  801835:	74 35                	je     80186c <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  801837:	83 ec 04             	sub    $0x4,%esp
  80183a:	ff 75 10             	pushl  0x10(%ebp)
  80183d:	ff 75 0c             	pushl  0xc(%ebp)
  801840:	50                   	push   %eax
  801841:	ff d2                	call   *%edx
  801843:	83 c4 10             	add    $0x10,%esp
}
  801846:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801849:	c9                   	leave  
  80184a:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  80184b:	a1 b0 40 80 00       	mov    0x8040b0,%eax
  801850:	8b 40 48             	mov    0x48(%eax),%eax
  801853:	83 ec 04             	sub    $0x4,%esp
  801856:	53                   	push   %ebx
  801857:	50                   	push   %eax
  801858:	68 59 2a 80 00       	push   $0x802a59
  80185d:	e8 e0 ee ff ff       	call   800742 <cprintf>
		return -E_INVAL;
  801862:	83 c4 10             	add    $0x10,%esp
  801865:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80186a:	eb da                	jmp    801846 <write+0x59>
		return -E_NOT_SUPP;
  80186c:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801871:	eb d3                	jmp    801846 <write+0x59>

00801873 <seek>:

int
seek(int fdnum, off_t offset)
{
  801873:	f3 0f 1e fb          	endbr32 
  801877:	55                   	push   %ebp
  801878:	89 e5                	mov    %esp,%ebp
  80187a:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80187d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801880:	50                   	push   %eax
  801881:	ff 75 08             	pushl  0x8(%ebp)
  801884:	e8 0b fc ff ff       	call   801494 <fd_lookup>
  801889:	83 c4 10             	add    $0x10,%esp
  80188c:	85 c0                	test   %eax,%eax
  80188e:	78 0e                	js     80189e <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  801890:	8b 55 0c             	mov    0xc(%ebp),%edx
  801893:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801896:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  801899:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80189e:	c9                   	leave  
  80189f:	c3                   	ret    

008018a0 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  8018a0:	f3 0f 1e fb          	endbr32 
  8018a4:	55                   	push   %ebp
  8018a5:	89 e5                	mov    %esp,%ebp
  8018a7:	53                   	push   %ebx
  8018a8:	83 ec 1c             	sub    $0x1c,%esp
  8018ab:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  8018ae:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8018b1:	50                   	push   %eax
  8018b2:	53                   	push   %ebx
  8018b3:	e8 dc fb ff ff       	call   801494 <fd_lookup>
  8018b8:	83 c4 10             	add    $0x10,%esp
  8018bb:	85 c0                	test   %eax,%eax
  8018bd:	78 37                	js     8018f6 <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8018bf:	83 ec 08             	sub    $0x8,%esp
  8018c2:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8018c5:	50                   	push   %eax
  8018c6:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8018c9:	ff 30                	pushl  (%eax)
  8018cb:	e8 18 fc ff ff       	call   8014e8 <dev_lookup>
  8018d0:	83 c4 10             	add    $0x10,%esp
  8018d3:	85 c0                	test   %eax,%eax
  8018d5:	78 1f                	js     8018f6 <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8018d7:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8018da:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8018de:	74 1b                	je     8018fb <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  8018e0:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8018e3:	8b 52 18             	mov    0x18(%edx),%edx
  8018e6:	85 d2                	test   %edx,%edx
  8018e8:	74 32                	je     80191c <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  8018ea:	83 ec 08             	sub    $0x8,%esp
  8018ed:	ff 75 0c             	pushl  0xc(%ebp)
  8018f0:	50                   	push   %eax
  8018f1:	ff d2                	call   *%edx
  8018f3:	83 c4 10             	add    $0x10,%esp
}
  8018f6:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8018f9:	c9                   	leave  
  8018fa:	c3                   	ret    
			thisenv->env_id, fdnum);
  8018fb:	a1 b0 40 80 00       	mov    0x8040b0,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  801900:	8b 40 48             	mov    0x48(%eax),%eax
  801903:	83 ec 04             	sub    $0x4,%esp
  801906:	53                   	push   %ebx
  801907:	50                   	push   %eax
  801908:	68 1c 2a 80 00       	push   $0x802a1c
  80190d:	e8 30 ee ff ff       	call   800742 <cprintf>
		return -E_INVAL;
  801912:	83 c4 10             	add    $0x10,%esp
  801915:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80191a:	eb da                	jmp    8018f6 <ftruncate+0x56>
		return -E_NOT_SUPP;
  80191c:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801921:	eb d3                	jmp    8018f6 <ftruncate+0x56>

00801923 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  801923:	f3 0f 1e fb          	endbr32 
  801927:	55                   	push   %ebp
  801928:	89 e5                	mov    %esp,%ebp
  80192a:	53                   	push   %ebx
  80192b:	83 ec 1c             	sub    $0x1c,%esp
  80192e:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801931:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801934:	50                   	push   %eax
  801935:	ff 75 08             	pushl  0x8(%ebp)
  801938:	e8 57 fb ff ff       	call   801494 <fd_lookup>
  80193d:	83 c4 10             	add    $0x10,%esp
  801940:	85 c0                	test   %eax,%eax
  801942:	78 4b                	js     80198f <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801944:	83 ec 08             	sub    $0x8,%esp
  801947:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80194a:	50                   	push   %eax
  80194b:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80194e:	ff 30                	pushl  (%eax)
  801950:	e8 93 fb ff ff       	call   8014e8 <dev_lookup>
  801955:	83 c4 10             	add    $0x10,%esp
  801958:	85 c0                	test   %eax,%eax
  80195a:	78 33                	js     80198f <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  80195c:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80195f:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  801963:	74 2f                	je     801994 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  801965:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  801968:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  80196f:	00 00 00 
	stat->st_isdir = 0;
  801972:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801979:	00 00 00 
	stat->st_dev = dev;
  80197c:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  801982:	83 ec 08             	sub    $0x8,%esp
  801985:	53                   	push   %ebx
  801986:	ff 75 f0             	pushl  -0x10(%ebp)
  801989:	ff 50 14             	call   *0x14(%eax)
  80198c:	83 c4 10             	add    $0x10,%esp
}
  80198f:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801992:	c9                   	leave  
  801993:	c3                   	ret    
		return -E_NOT_SUPP;
  801994:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801999:	eb f4                	jmp    80198f <fstat+0x6c>

0080199b <stat>:

int
stat(const char *path, struct Stat *stat)
{
  80199b:	f3 0f 1e fb          	endbr32 
  80199f:	55                   	push   %ebp
  8019a0:	89 e5                	mov    %esp,%ebp
  8019a2:	56                   	push   %esi
  8019a3:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  8019a4:	83 ec 08             	sub    $0x8,%esp
  8019a7:	6a 00                	push   $0x0
  8019a9:	ff 75 08             	pushl  0x8(%ebp)
  8019ac:	e8 fb 01 00 00       	call   801bac <open>
  8019b1:	89 c3                	mov    %eax,%ebx
  8019b3:	83 c4 10             	add    $0x10,%esp
  8019b6:	85 c0                	test   %eax,%eax
  8019b8:	78 1b                	js     8019d5 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  8019ba:	83 ec 08             	sub    $0x8,%esp
  8019bd:	ff 75 0c             	pushl  0xc(%ebp)
  8019c0:	50                   	push   %eax
  8019c1:	e8 5d ff ff ff       	call   801923 <fstat>
  8019c6:	89 c6                	mov    %eax,%esi
	close(fd);
  8019c8:	89 1c 24             	mov    %ebx,(%esp)
  8019cb:	e8 fd fb ff ff       	call   8015cd <close>
	return r;
  8019d0:	83 c4 10             	add    $0x10,%esp
  8019d3:	89 f3                	mov    %esi,%ebx
}
  8019d5:	89 d8                	mov    %ebx,%eax
  8019d7:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8019da:	5b                   	pop    %ebx
  8019db:	5e                   	pop    %esi
  8019dc:	5d                   	pop    %ebp
  8019dd:	c3                   	ret    

008019de <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  8019de:	55                   	push   %ebp
  8019df:	89 e5                	mov    %esp,%ebp
  8019e1:	56                   	push   %esi
  8019e2:	53                   	push   %ebx
  8019e3:	89 c6                	mov    %eax,%esi
  8019e5:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  8019e7:	83 3d ac 40 80 00 00 	cmpl   $0x0,0x8040ac
  8019ee:	74 27                	je     801a17 <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  8019f0:	6a 07                	push   $0x7
  8019f2:	68 00 50 80 00       	push   $0x805000
  8019f7:	56                   	push   %esi
  8019f8:	ff 35 ac 40 80 00    	pushl  0x8040ac
  8019fe:	e8 d2 07 00 00       	call   8021d5 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  801a03:	83 c4 0c             	add    $0xc,%esp
  801a06:	6a 00                	push   $0x0
  801a08:	53                   	push   %ebx
  801a09:	6a 00                	push   $0x0
  801a0b:	e8 44 07 00 00       	call   802154 <ipc_recv>
}
  801a10:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801a13:	5b                   	pop    %ebx
  801a14:	5e                   	pop    %esi
  801a15:	5d                   	pop    %ebp
  801a16:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  801a17:	83 ec 0c             	sub    $0xc,%esp
  801a1a:	6a 01                	push   $0x1
  801a1c:	e8 0c 08 00 00       	call   80222d <ipc_find_env>
  801a21:	a3 ac 40 80 00       	mov    %eax,0x8040ac
  801a26:	83 c4 10             	add    $0x10,%esp
  801a29:	eb c5                	jmp    8019f0 <fsipc+0x12>

00801a2b <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  801a2b:	f3 0f 1e fb          	endbr32 
  801a2f:	55                   	push   %ebp
  801a30:	89 e5                	mov    %esp,%ebp
  801a32:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  801a35:	8b 45 08             	mov    0x8(%ebp),%eax
  801a38:	8b 40 0c             	mov    0xc(%eax),%eax
  801a3b:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  801a40:	8b 45 0c             	mov    0xc(%ebp),%eax
  801a43:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  801a48:	ba 00 00 00 00       	mov    $0x0,%edx
  801a4d:	b8 02 00 00 00       	mov    $0x2,%eax
  801a52:	e8 87 ff ff ff       	call   8019de <fsipc>
}
  801a57:	c9                   	leave  
  801a58:	c3                   	ret    

00801a59 <devfile_flush>:
{
  801a59:	f3 0f 1e fb          	endbr32 
  801a5d:	55                   	push   %ebp
  801a5e:	89 e5                	mov    %esp,%ebp
  801a60:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  801a63:	8b 45 08             	mov    0x8(%ebp),%eax
  801a66:	8b 40 0c             	mov    0xc(%eax),%eax
  801a69:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  801a6e:	ba 00 00 00 00       	mov    $0x0,%edx
  801a73:	b8 06 00 00 00       	mov    $0x6,%eax
  801a78:	e8 61 ff ff ff       	call   8019de <fsipc>
}
  801a7d:	c9                   	leave  
  801a7e:	c3                   	ret    

00801a7f <devfile_stat>:
{
  801a7f:	f3 0f 1e fb          	endbr32 
  801a83:	55                   	push   %ebp
  801a84:	89 e5                	mov    %esp,%ebp
  801a86:	53                   	push   %ebx
  801a87:	83 ec 04             	sub    $0x4,%esp
  801a8a:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801a8d:	8b 45 08             	mov    0x8(%ebp),%eax
  801a90:	8b 40 0c             	mov    0xc(%eax),%eax
  801a93:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  801a98:	ba 00 00 00 00       	mov    $0x0,%edx
  801a9d:	b8 05 00 00 00       	mov    $0x5,%eax
  801aa2:	e8 37 ff ff ff       	call   8019de <fsipc>
  801aa7:	85 c0                	test   %eax,%eax
  801aa9:	78 2c                	js     801ad7 <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801aab:	83 ec 08             	sub    $0x8,%esp
  801aae:	68 00 50 80 00       	push   $0x805000
  801ab3:	53                   	push   %ebx
  801ab4:	e8 62 f2 ff ff       	call   800d1b <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  801ab9:	a1 80 50 80 00       	mov    0x805080,%eax
  801abe:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  801ac4:	a1 84 50 80 00       	mov    0x805084,%eax
  801ac9:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  801acf:	83 c4 10             	add    $0x10,%esp
  801ad2:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801ad7:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801ada:	c9                   	leave  
  801adb:	c3                   	ret    

00801adc <devfile_write>:
{
  801adc:	f3 0f 1e fb          	endbr32 
  801ae0:	55                   	push   %ebp
  801ae1:	89 e5                	mov    %esp,%ebp
  801ae3:	83 ec 0c             	sub    $0xc,%esp
  801ae6:	8b 45 10             	mov    0x10(%ebp),%eax
  801ae9:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801aee:	ba f8 0f 00 00       	mov    $0xff8,%edx
  801af3:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  801af6:	8b 55 08             	mov    0x8(%ebp),%edx
  801af9:	8b 52 0c             	mov    0xc(%edx),%edx
  801afc:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  801b02:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  801b07:	50                   	push   %eax
  801b08:	ff 75 0c             	pushl  0xc(%ebp)
  801b0b:	68 08 50 80 00       	push   $0x805008
  801b10:	e8 bc f3 ff ff       	call   800ed1 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  801b15:	ba 00 00 00 00       	mov    $0x0,%edx
  801b1a:	b8 04 00 00 00       	mov    $0x4,%eax
  801b1f:	e8 ba fe ff ff       	call   8019de <fsipc>
  801b24:	c9                   	leave  
  801b25:	c3                   	ret    

00801b26 <devfile_read>:
{
  801b26:	f3 0f 1e fb          	endbr32 
  801b2a:	55                   	push   %ebp
  801b2b:	89 e5                	mov    %esp,%ebp
  801b2d:	56                   	push   %esi
  801b2e:	53                   	push   %ebx
  801b2f:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801b32:	8b 45 08             	mov    0x8(%ebp),%eax
  801b35:	8b 40 0c             	mov    0xc(%eax),%eax
  801b38:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801b3d:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801b43:	ba 00 00 00 00       	mov    $0x0,%edx
  801b48:	b8 03 00 00 00       	mov    $0x3,%eax
  801b4d:	e8 8c fe ff ff       	call   8019de <fsipc>
  801b52:	89 c3                	mov    %eax,%ebx
  801b54:	85 c0                	test   %eax,%eax
  801b56:	78 1f                	js     801b77 <devfile_read+0x51>
	assert(r <= n);
  801b58:	39 f0                	cmp    %esi,%eax
  801b5a:	77 24                	ja     801b80 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  801b5c:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801b61:	7f 33                	jg     801b96 <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801b63:	83 ec 04             	sub    $0x4,%esp
  801b66:	50                   	push   %eax
  801b67:	68 00 50 80 00       	push   $0x805000
  801b6c:	ff 75 0c             	pushl  0xc(%ebp)
  801b6f:	e8 5d f3 ff ff       	call   800ed1 <memmove>
	return r;
  801b74:	83 c4 10             	add    $0x10,%esp
}
  801b77:	89 d8                	mov    %ebx,%eax
  801b79:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801b7c:	5b                   	pop    %ebx
  801b7d:	5e                   	pop    %esi
  801b7e:	5d                   	pop    %ebp
  801b7f:	c3                   	ret    
	assert(r <= n);
  801b80:	68 88 2a 80 00       	push   $0x802a88
  801b85:	68 8f 2a 80 00       	push   $0x802a8f
  801b8a:	6a 7c                	push   $0x7c
  801b8c:	68 a4 2a 80 00       	push   $0x802aa4
  801b91:	e8 c5 ea ff ff       	call   80065b <_panic>
	assert(r <= PGSIZE);
  801b96:	68 af 2a 80 00       	push   $0x802aaf
  801b9b:	68 8f 2a 80 00       	push   $0x802a8f
  801ba0:	6a 7d                	push   $0x7d
  801ba2:	68 a4 2a 80 00       	push   $0x802aa4
  801ba7:	e8 af ea ff ff       	call   80065b <_panic>

00801bac <open>:
{
  801bac:	f3 0f 1e fb          	endbr32 
  801bb0:	55                   	push   %ebp
  801bb1:	89 e5                	mov    %esp,%ebp
  801bb3:	56                   	push   %esi
  801bb4:	53                   	push   %ebx
  801bb5:	83 ec 1c             	sub    $0x1c,%esp
  801bb8:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801bbb:	56                   	push   %esi
  801bbc:	e8 17 f1 ff ff       	call   800cd8 <strlen>
  801bc1:	83 c4 10             	add    $0x10,%esp
  801bc4:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801bc9:	7f 6c                	jg     801c37 <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801bcb:	83 ec 0c             	sub    $0xc,%esp
  801bce:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801bd1:	50                   	push   %eax
  801bd2:	e8 67 f8 ff ff       	call   80143e <fd_alloc>
  801bd7:	89 c3                	mov    %eax,%ebx
  801bd9:	83 c4 10             	add    $0x10,%esp
  801bdc:	85 c0                	test   %eax,%eax
  801bde:	78 3c                	js     801c1c <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801be0:	83 ec 08             	sub    $0x8,%esp
  801be3:	56                   	push   %esi
  801be4:	68 00 50 80 00       	push   $0x805000
  801be9:	e8 2d f1 ff ff       	call   800d1b <strcpy>
	fsipcbuf.open.req_omode = mode;
  801bee:	8b 45 0c             	mov    0xc(%ebp),%eax
  801bf1:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801bf6:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801bf9:	b8 01 00 00 00       	mov    $0x1,%eax
  801bfe:	e8 db fd ff ff       	call   8019de <fsipc>
  801c03:	89 c3                	mov    %eax,%ebx
  801c05:	83 c4 10             	add    $0x10,%esp
  801c08:	85 c0                	test   %eax,%eax
  801c0a:	78 19                	js     801c25 <open+0x79>
	return fd2num(fd);
  801c0c:	83 ec 0c             	sub    $0xc,%esp
  801c0f:	ff 75 f4             	pushl  -0xc(%ebp)
  801c12:	e8 f8 f7 ff ff       	call   80140f <fd2num>
  801c17:	89 c3                	mov    %eax,%ebx
  801c19:	83 c4 10             	add    $0x10,%esp
}
  801c1c:	89 d8                	mov    %ebx,%eax
  801c1e:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801c21:	5b                   	pop    %ebx
  801c22:	5e                   	pop    %esi
  801c23:	5d                   	pop    %ebp
  801c24:	c3                   	ret    
		fd_close(fd, 0);
  801c25:	83 ec 08             	sub    $0x8,%esp
  801c28:	6a 00                	push   $0x0
  801c2a:	ff 75 f4             	pushl  -0xc(%ebp)
  801c2d:	e8 10 f9 ff ff       	call   801542 <fd_close>
		return r;
  801c32:	83 c4 10             	add    $0x10,%esp
  801c35:	eb e5                	jmp    801c1c <open+0x70>
		return -E_BAD_PATH;
  801c37:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801c3c:	eb de                	jmp    801c1c <open+0x70>

00801c3e <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801c3e:	f3 0f 1e fb          	endbr32 
  801c42:	55                   	push   %ebp
  801c43:	89 e5                	mov    %esp,%ebp
  801c45:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801c48:	ba 00 00 00 00       	mov    $0x0,%edx
  801c4d:	b8 08 00 00 00       	mov    $0x8,%eax
  801c52:	e8 87 fd ff ff       	call   8019de <fsipc>
}
  801c57:	c9                   	leave  
  801c58:	c3                   	ret    

00801c59 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801c59:	f3 0f 1e fb          	endbr32 
  801c5d:	55                   	push   %ebp
  801c5e:	89 e5                	mov    %esp,%ebp
  801c60:	56                   	push   %esi
  801c61:	53                   	push   %ebx
  801c62:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801c65:	83 ec 0c             	sub    $0xc,%esp
  801c68:	ff 75 08             	pushl  0x8(%ebp)
  801c6b:	e8 b3 f7 ff ff       	call   801423 <fd2data>
  801c70:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801c72:	83 c4 08             	add    $0x8,%esp
  801c75:	68 bb 2a 80 00       	push   $0x802abb
  801c7a:	53                   	push   %ebx
  801c7b:	e8 9b f0 ff ff       	call   800d1b <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801c80:	8b 46 04             	mov    0x4(%esi),%eax
  801c83:	2b 06                	sub    (%esi),%eax
  801c85:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801c8b:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801c92:	00 00 00 
	stat->st_dev = &devpipe;
  801c95:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801c9c:	30 80 00 
	return 0;
}
  801c9f:	b8 00 00 00 00       	mov    $0x0,%eax
  801ca4:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801ca7:	5b                   	pop    %ebx
  801ca8:	5e                   	pop    %esi
  801ca9:	5d                   	pop    %ebp
  801caa:	c3                   	ret    

00801cab <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801cab:	f3 0f 1e fb          	endbr32 
  801caf:	55                   	push   %ebp
  801cb0:	89 e5                	mov    %esp,%ebp
  801cb2:	53                   	push   %ebx
  801cb3:	83 ec 0c             	sub    $0xc,%esp
  801cb6:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801cb9:	53                   	push   %ebx
  801cba:	6a 00                	push   $0x0
  801cbc:	e8 29 f5 ff ff       	call   8011ea <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801cc1:	89 1c 24             	mov    %ebx,(%esp)
  801cc4:	e8 5a f7 ff ff       	call   801423 <fd2data>
  801cc9:	83 c4 08             	add    $0x8,%esp
  801ccc:	50                   	push   %eax
  801ccd:	6a 00                	push   $0x0
  801ccf:	e8 16 f5 ff ff       	call   8011ea <sys_page_unmap>
}
  801cd4:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801cd7:	c9                   	leave  
  801cd8:	c3                   	ret    

00801cd9 <_pipeisclosed>:
{
  801cd9:	55                   	push   %ebp
  801cda:	89 e5                	mov    %esp,%ebp
  801cdc:	57                   	push   %edi
  801cdd:	56                   	push   %esi
  801cde:	53                   	push   %ebx
  801cdf:	83 ec 1c             	sub    $0x1c,%esp
  801ce2:	89 c7                	mov    %eax,%edi
  801ce4:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801ce6:	a1 b0 40 80 00       	mov    0x8040b0,%eax
  801ceb:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801cee:	83 ec 0c             	sub    $0xc,%esp
  801cf1:	57                   	push   %edi
  801cf2:	e8 73 05 00 00       	call   80226a <pageref>
  801cf7:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801cfa:	89 34 24             	mov    %esi,(%esp)
  801cfd:	e8 68 05 00 00       	call   80226a <pageref>
		nn = thisenv->env_runs;
  801d02:	8b 15 b0 40 80 00    	mov    0x8040b0,%edx
  801d08:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801d0b:	83 c4 10             	add    $0x10,%esp
  801d0e:	39 cb                	cmp    %ecx,%ebx
  801d10:	74 1b                	je     801d2d <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801d12:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801d15:	75 cf                	jne    801ce6 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801d17:	8b 42 58             	mov    0x58(%edx),%eax
  801d1a:	6a 01                	push   $0x1
  801d1c:	50                   	push   %eax
  801d1d:	53                   	push   %ebx
  801d1e:	68 c2 2a 80 00       	push   $0x802ac2
  801d23:	e8 1a ea ff ff       	call   800742 <cprintf>
  801d28:	83 c4 10             	add    $0x10,%esp
  801d2b:	eb b9                	jmp    801ce6 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801d2d:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801d30:	0f 94 c0             	sete   %al
  801d33:	0f b6 c0             	movzbl %al,%eax
}
  801d36:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801d39:	5b                   	pop    %ebx
  801d3a:	5e                   	pop    %esi
  801d3b:	5f                   	pop    %edi
  801d3c:	5d                   	pop    %ebp
  801d3d:	c3                   	ret    

00801d3e <devpipe_write>:
{
  801d3e:	f3 0f 1e fb          	endbr32 
  801d42:	55                   	push   %ebp
  801d43:	89 e5                	mov    %esp,%ebp
  801d45:	57                   	push   %edi
  801d46:	56                   	push   %esi
  801d47:	53                   	push   %ebx
  801d48:	83 ec 28             	sub    $0x28,%esp
  801d4b:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801d4e:	56                   	push   %esi
  801d4f:	e8 cf f6 ff ff       	call   801423 <fd2data>
  801d54:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801d56:	83 c4 10             	add    $0x10,%esp
  801d59:	bf 00 00 00 00       	mov    $0x0,%edi
  801d5e:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801d61:	74 4f                	je     801db2 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801d63:	8b 43 04             	mov    0x4(%ebx),%eax
  801d66:	8b 0b                	mov    (%ebx),%ecx
  801d68:	8d 51 20             	lea    0x20(%ecx),%edx
  801d6b:	39 d0                	cmp    %edx,%eax
  801d6d:	72 14                	jb     801d83 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801d6f:	89 da                	mov    %ebx,%edx
  801d71:	89 f0                	mov    %esi,%eax
  801d73:	e8 61 ff ff ff       	call   801cd9 <_pipeisclosed>
  801d78:	85 c0                	test   %eax,%eax
  801d7a:	75 3b                	jne    801db7 <devpipe_write+0x79>
			sys_yield();
  801d7c:	e8 b9 f3 ff ff       	call   80113a <sys_yield>
  801d81:	eb e0                	jmp    801d63 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801d83:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801d86:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801d8a:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801d8d:	89 c2                	mov    %eax,%edx
  801d8f:	c1 fa 1f             	sar    $0x1f,%edx
  801d92:	89 d1                	mov    %edx,%ecx
  801d94:	c1 e9 1b             	shr    $0x1b,%ecx
  801d97:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801d9a:	83 e2 1f             	and    $0x1f,%edx
  801d9d:	29 ca                	sub    %ecx,%edx
  801d9f:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801da3:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801da7:	83 c0 01             	add    $0x1,%eax
  801daa:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801dad:	83 c7 01             	add    $0x1,%edi
  801db0:	eb ac                	jmp    801d5e <devpipe_write+0x20>
	return i;
  801db2:	8b 45 10             	mov    0x10(%ebp),%eax
  801db5:	eb 05                	jmp    801dbc <devpipe_write+0x7e>
				return 0;
  801db7:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801dbc:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801dbf:	5b                   	pop    %ebx
  801dc0:	5e                   	pop    %esi
  801dc1:	5f                   	pop    %edi
  801dc2:	5d                   	pop    %ebp
  801dc3:	c3                   	ret    

00801dc4 <devpipe_read>:
{
  801dc4:	f3 0f 1e fb          	endbr32 
  801dc8:	55                   	push   %ebp
  801dc9:	89 e5                	mov    %esp,%ebp
  801dcb:	57                   	push   %edi
  801dcc:	56                   	push   %esi
  801dcd:	53                   	push   %ebx
  801dce:	83 ec 18             	sub    $0x18,%esp
  801dd1:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801dd4:	57                   	push   %edi
  801dd5:	e8 49 f6 ff ff       	call   801423 <fd2data>
  801dda:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801ddc:	83 c4 10             	add    $0x10,%esp
  801ddf:	be 00 00 00 00       	mov    $0x0,%esi
  801de4:	3b 75 10             	cmp    0x10(%ebp),%esi
  801de7:	75 14                	jne    801dfd <devpipe_read+0x39>
	return i;
  801de9:	8b 45 10             	mov    0x10(%ebp),%eax
  801dec:	eb 02                	jmp    801df0 <devpipe_read+0x2c>
				return i;
  801dee:	89 f0                	mov    %esi,%eax
}
  801df0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801df3:	5b                   	pop    %ebx
  801df4:	5e                   	pop    %esi
  801df5:	5f                   	pop    %edi
  801df6:	5d                   	pop    %ebp
  801df7:	c3                   	ret    
			sys_yield();
  801df8:	e8 3d f3 ff ff       	call   80113a <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801dfd:	8b 03                	mov    (%ebx),%eax
  801dff:	3b 43 04             	cmp    0x4(%ebx),%eax
  801e02:	75 18                	jne    801e1c <devpipe_read+0x58>
			if (i > 0)
  801e04:	85 f6                	test   %esi,%esi
  801e06:	75 e6                	jne    801dee <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801e08:	89 da                	mov    %ebx,%edx
  801e0a:	89 f8                	mov    %edi,%eax
  801e0c:	e8 c8 fe ff ff       	call   801cd9 <_pipeisclosed>
  801e11:	85 c0                	test   %eax,%eax
  801e13:	74 e3                	je     801df8 <devpipe_read+0x34>
				return 0;
  801e15:	b8 00 00 00 00       	mov    $0x0,%eax
  801e1a:	eb d4                	jmp    801df0 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801e1c:	99                   	cltd   
  801e1d:	c1 ea 1b             	shr    $0x1b,%edx
  801e20:	01 d0                	add    %edx,%eax
  801e22:	83 e0 1f             	and    $0x1f,%eax
  801e25:	29 d0                	sub    %edx,%eax
  801e27:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801e2c:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801e2f:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801e32:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801e35:	83 c6 01             	add    $0x1,%esi
  801e38:	eb aa                	jmp    801de4 <devpipe_read+0x20>

00801e3a <pipe>:
{
  801e3a:	f3 0f 1e fb          	endbr32 
  801e3e:	55                   	push   %ebp
  801e3f:	89 e5                	mov    %esp,%ebp
  801e41:	56                   	push   %esi
  801e42:	53                   	push   %ebx
  801e43:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801e46:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e49:	50                   	push   %eax
  801e4a:	e8 ef f5 ff ff       	call   80143e <fd_alloc>
  801e4f:	89 c3                	mov    %eax,%ebx
  801e51:	83 c4 10             	add    $0x10,%esp
  801e54:	85 c0                	test   %eax,%eax
  801e56:	0f 88 23 01 00 00    	js     801f7f <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801e5c:	83 ec 04             	sub    $0x4,%esp
  801e5f:	68 07 04 00 00       	push   $0x407
  801e64:	ff 75 f4             	pushl  -0xc(%ebp)
  801e67:	6a 00                	push   $0x0
  801e69:	e8 ef f2 ff ff       	call   80115d <sys_page_alloc>
  801e6e:	89 c3                	mov    %eax,%ebx
  801e70:	83 c4 10             	add    $0x10,%esp
  801e73:	85 c0                	test   %eax,%eax
  801e75:	0f 88 04 01 00 00    	js     801f7f <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801e7b:	83 ec 0c             	sub    $0xc,%esp
  801e7e:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801e81:	50                   	push   %eax
  801e82:	e8 b7 f5 ff ff       	call   80143e <fd_alloc>
  801e87:	89 c3                	mov    %eax,%ebx
  801e89:	83 c4 10             	add    $0x10,%esp
  801e8c:	85 c0                	test   %eax,%eax
  801e8e:	0f 88 db 00 00 00    	js     801f6f <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801e94:	83 ec 04             	sub    $0x4,%esp
  801e97:	68 07 04 00 00       	push   $0x407
  801e9c:	ff 75 f0             	pushl  -0x10(%ebp)
  801e9f:	6a 00                	push   $0x0
  801ea1:	e8 b7 f2 ff ff       	call   80115d <sys_page_alloc>
  801ea6:	89 c3                	mov    %eax,%ebx
  801ea8:	83 c4 10             	add    $0x10,%esp
  801eab:	85 c0                	test   %eax,%eax
  801ead:	0f 88 bc 00 00 00    	js     801f6f <pipe+0x135>
	va = fd2data(fd0);
  801eb3:	83 ec 0c             	sub    $0xc,%esp
  801eb6:	ff 75 f4             	pushl  -0xc(%ebp)
  801eb9:	e8 65 f5 ff ff       	call   801423 <fd2data>
  801ebe:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ec0:	83 c4 0c             	add    $0xc,%esp
  801ec3:	68 07 04 00 00       	push   $0x407
  801ec8:	50                   	push   %eax
  801ec9:	6a 00                	push   $0x0
  801ecb:	e8 8d f2 ff ff       	call   80115d <sys_page_alloc>
  801ed0:	89 c3                	mov    %eax,%ebx
  801ed2:	83 c4 10             	add    $0x10,%esp
  801ed5:	85 c0                	test   %eax,%eax
  801ed7:	0f 88 82 00 00 00    	js     801f5f <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801edd:	83 ec 0c             	sub    $0xc,%esp
  801ee0:	ff 75 f0             	pushl  -0x10(%ebp)
  801ee3:	e8 3b f5 ff ff       	call   801423 <fd2data>
  801ee8:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801eef:	50                   	push   %eax
  801ef0:	6a 00                	push   $0x0
  801ef2:	56                   	push   %esi
  801ef3:	6a 00                	push   $0x0
  801ef5:	e8 aa f2 ff ff       	call   8011a4 <sys_page_map>
  801efa:	89 c3                	mov    %eax,%ebx
  801efc:	83 c4 20             	add    $0x20,%esp
  801eff:	85 c0                	test   %eax,%eax
  801f01:	78 4e                	js     801f51 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801f03:	a1 20 30 80 00       	mov    0x803020,%eax
  801f08:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801f0b:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801f0d:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801f10:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801f17:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801f1a:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801f1c:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801f1f:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801f26:	83 ec 0c             	sub    $0xc,%esp
  801f29:	ff 75 f4             	pushl  -0xc(%ebp)
  801f2c:	e8 de f4 ff ff       	call   80140f <fd2num>
  801f31:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801f34:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801f36:	83 c4 04             	add    $0x4,%esp
  801f39:	ff 75 f0             	pushl  -0x10(%ebp)
  801f3c:	e8 ce f4 ff ff       	call   80140f <fd2num>
  801f41:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801f44:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801f47:	83 c4 10             	add    $0x10,%esp
  801f4a:	bb 00 00 00 00       	mov    $0x0,%ebx
  801f4f:	eb 2e                	jmp    801f7f <pipe+0x145>
	sys_page_unmap(0, va);
  801f51:	83 ec 08             	sub    $0x8,%esp
  801f54:	56                   	push   %esi
  801f55:	6a 00                	push   $0x0
  801f57:	e8 8e f2 ff ff       	call   8011ea <sys_page_unmap>
  801f5c:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801f5f:	83 ec 08             	sub    $0x8,%esp
  801f62:	ff 75 f0             	pushl  -0x10(%ebp)
  801f65:	6a 00                	push   $0x0
  801f67:	e8 7e f2 ff ff       	call   8011ea <sys_page_unmap>
  801f6c:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801f6f:	83 ec 08             	sub    $0x8,%esp
  801f72:	ff 75 f4             	pushl  -0xc(%ebp)
  801f75:	6a 00                	push   $0x0
  801f77:	e8 6e f2 ff ff       	call   8011ea <sys_page_unmap>
  801f7c:	83 c4 10             	add    $0x10,%esp
}
  801f7f:	89 d8                	mov    %ebx,%eax
  801f81:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801f84:	5b                   	pop    %ebx
  801f85:	5e                   	pop    %esi
  801f86:	5d                   	pop    %ebp
  801f87:	c3                   	ret    

00801f88 <pipeisclosed>:
{
  801f88:	f3 0f 1e fb          	endbr32 
  801f8c:	55                   	push   %ebp
  801f8d:	89 e5                	mov    %esp,%ebp
  801f8f:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801f92:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801f95:	50                   	push   %eax
  801f96:	ff 75 08             	pushl  0x8(%ebp)
  801f99:	e8 f6 f4 ff ff       	call   801494 <fd_lookup>
  801f9e:	83 c4 10             	add    $0x10,%esp
  801fa1:	85 c0                	test   %eax,%eax
  801fa3:	78 18                	js     801fbd <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801fa5:	83 ec 0c             	sub    $0xc,%esp
  801fa8:	ff 75 f4             	pushl  -0xc(%ebp)
  801fab:	e8 73 f4 ff ff       	call   801423 <fd2data>
  801fb0:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801fb2:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801fb5:	e8 1f fd ff ff       	call   801cd9 <_pipeisclosed>
  801fba:	83 c4 10             	add    $0x10,%esp
}
  801fbd:	c9                   	leave  
  801fbe:	c3                   	ret    

00801fbf <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801fbf:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801fc3:	b8 00 00 00 00       	mov    $0x0,%eax
  801fc8:	c3                   	ret    

00801fc9 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801fc9:	f3 0f 1e fb          	endbr32 
  801fcd:	55                   	push   %ebp
  801fce:	89 e5                	mov    %esp,%ebp
  801fd0:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801fd3:	68 da 2a 80 00       	push   $0x802ada
  801fd8:	ff 75 0c             	pushl  0xc(%ebp)
  801fdb:	e8 3b ed ff ff       	call   800d1b <strcpy>
	return 0;
}
  801fe0:	b8 00 00 00 00       	mov    $0x0,%eax
  801fe5:	c9                   	leave  
  801fe6:	c3                   	ret    

00801fe7 <devcons_write>:
{
  801fe7:	f3 0f 1e fb          	endbr32 
  801feb:	55                   	push   %ebp
  801fec:	89 e5                	mov    %esp,%ebp
  801fee:	57                   	push   %edi
  801fef:	56                   	push   %esi
  801ff0:	53                   	push   %ebx
  801ff1:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801ff7:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801ffc:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  802002:	3b 75 10             	cmp    0x10(%ebp),%esi
  802005:	73 31                	jae    802038 <devcons_write+0x51>
		m = n - tot;
  802007:	8b 5d 10             	mov    0x10(%ebp),%ebx
  80200a:	29 f3                	sub    %esi,%ebx
  80200c:	83 fb 7f             	cmp    $0x7f,%ebx
  80200f:	b8 7f 00 00 00       	mov    $0x7f,%eax
  802014:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  802017:	83 ec 04             	sub    $0x4,%esp
  80201a:	53                   	push   %ebx
  80201b:	89 f0                	mov    %esi,%eax
  80201d:	03 45 0c             	add    0xc(%ebp),%eax
  802020:	50                   	push   %eax
  802021:	57                   	push   %edi
  802022:	e8 aa ee ff ff       	call   800ed1 <memmove>
		sys_cputs(buf, m);
  802027:	83 c4 08             	add    $0x8,%esp
  80202a:	53                   	push   %ebx
  80202b:	57                   	push   %edi
  80202c:	e8 5c f0 ff ff       	call   80108d <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  802031:	01 de                	add    %ebx,%esi
  802033:	83 c4 10             	add    $0x10,%esp
  802036:	eb ca                	jmp    802002 <devcons_write+0x1b>
}
  802038:	89 f0                	mov    %esi,%eax
  80203a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80203d:	5b                   	pop    %ebx
  80203e:	5e                   	pop    %esi
  80203f:	5f                   	pop    %edi
  802040:	5d                   	pop    %ebp
  802041:	c3                   	ret    

00802042 <devcons_read>:
{
  802042:	f3 0f 1e fb          	endbr32 
  802046:	55                   	push   %ebp
  802047:	89 e5                	mov    %esp,%ebp
  802049:	83 ec 08             	sub    $0x8,%esp
  80204c:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  802051:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  802055:	74 21                	je     802078 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  802057:	e8 53 f0 ff ff       	call   8010af <sys_cgetc>
  80205c:	85 c0                	test   %eax,%eax
  80205e:	75 07                	jne    802067 <devcons_read+0x25>
		sys_yield();
  802060:	e8 d5 f0 ff ff       	call   80113a <sys_yield>
  802065:	eb f0                	jmp    802057 <devcons_read+0x15>
	if (c < 0)
  802067:	78 0f                	js     802078 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  802069:	83 f8 04             	cmp    $0x4,%eax
  80206c:	74 0c                	je     80207a <devcons_read+0x38>
	*(char*)vbuf = c;
  80206e:	8b 55 0c             	mov    0xc(%ebp),%edx
  802071:	88 02                	mov    %al,(%edx)
	return 1;
  802073:	b8 01 00 00 00       	mov    $0x1,%eax
}
  802078:	c9                   	leave  
  802079:	c3                   	ret    
		return 0;
  80207a:	b8 00 00 00 00       	mov    $0x0,%eax
  80207f:	eb f7                	jmp    802078 <devcons_read+0x36>

00802081 <cputchar>:
{
  802081:	f3 0f 1e fb          	endbr32 
  802085:	55                   	push   %ebp
  802086:	89 e5                	mov    %esp,%ebp
  802088:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  80208b:	8b 45 08             	mov    0x8(%ebp),%eax
  80208e:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  802091:	6a 01                	push   $0x1
  802093:	8d 45 f7             	lea    -0x9(%ebp),%eax
  802096:	50                   	push   %eax
  802097:	e8 f1 ef ff ff       	call   80108d <sys_cputs>
}
  80209c:	83 c4 10             	add    $0x10,%esp
  80209f:	c9                   	leave  
  8020a0:	c3                   	ret    

008020a1 <getchar>:
{
  8020a1:	f3 0f 1e fb          	endbr32 
  8020a5:	55                   	push   %ebp
  8020a6:	89 e5                	mov    %esp,%ebp
  8020a8:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  8020ab:	6a 01                	push   $0x1
  8020ad:	8d 45 f7             	lea    -0x9(%ebp),%eax
  8020b0:	50                   	push   %eax
  8020b1:	6a 00                	push   $0x0
  8020b3:	e8 5f f6 ff ff       	call   801717 <read>
	if (r < 0)
  8020b8:	83 c4 10             	add    $0x10,%esp
  8020bb:	85 c0                	test   %eax,%eax
  8020bd:	78 06                	js     8020c5 <getchar+0x24>
	if (r < 1)
  8020bf:	74 06                	je     8020c7 <getchar+0x26>
	return c;
  8020c1:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  8020c5:	c9                   	leave  
  8020c6:	c3                   	ret    
		return -E_EOF;
  8020c7:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  8020cc:	eb f7                	jmp    8020c5 <getchar+0x24>

008020ce <iscons>:
{
  8020ce:	f3 0f 1e fb          	endbr32 
  8020d2:	55                   	push   %ebp
  8020d3:	89 e5                	mov    %esp,%ebp
  8020d5:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8020d8:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8020db:	50                   	push   %eax
  8020dc:	ff 75 08             	pushl  0x8(%ebp)
  8020df:	e8 b0 f3 ff ff       	call   801494 <fd_lookup>
  8020e4:	83 c4 10             	add    $0x10,%esp
  8020e7:	85 c0                	test   %eax,%eax
  8020e9:	78 11                	js     8020fc <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  8020eb:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8020ee:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  8020f4:	39 10                	cmp    %edx,(%eax)
  8020f6:	0f 94 c0             	sete   %al
  8020f9:	0f b6 c0             	movzbl %al,%eax
}
  8020fc:	c9                   	leave  
  8020fd:	c3                   	ret    

008020fe <opencons>:
{
  8020fe:	f3 0f 1e fb          	endbr32 
  802102:	55                   	push   %ebp
  802103:	89 e5                	mov    %esp,%ebp
  802105:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  802108:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80210b:	50                   	push   %eax
  80210c:	e8 2d f3 ff ff       	call   80143e <fd_alloc>
  802111:	83 c4 10             	add    $0x10,%esp
  802114:	85 c0                	test   %eax,%eax
  802116:	78 3a                	js     802152 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  802118:	83 ec 04             	sub    $0x4,%esp
  80211b:	68 07 04 00 00       	push   $0x407
  802120:	ff 75 f4             	pushl  -0xc(%ebp)
  802123:	6a 00                	push   $0x0
  802125:	e8 33 f0 ff ff       	call   80115d <sys_page_alloc>
  80212a:	83 c4 10             	add    $0x10,%esp
  80212d:	85 c0                	test   %eax,%eax
  80212f:	78 21                	js     802152 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  802131:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802134:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  80213a:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  80213c:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80213f:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  802146:	83 ec 0c             	sub    $0xc,%esp
  802149:	50                   	push   %eax
  80214a:	e8 c0 f2 ff ff       	call   80140f <fd2num>
  80214f:	83 c4 10             	add    $0x10,%esp
}
  802152:	c9                   	leave  
  802153:	c3                   	ret    

00802154 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  802154:	f3 0f 1e fb          	endbr32 
  802158:	55                   	push   %ebp
  802159:	89 e5                	mov    %esp,%ebp
  80215b:	56                   	push   %esi
  80215c:	53                   	push   %ebx
  80215d:	8b 75 08             	mov    0x8(%ebp),%esi
  802160:	8b 45 0c             	mov    0xc(%ebp),%eax
  802163:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  802166:	85 c0                	test   %eax,%eax
  802168:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  80216d:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  802170:	83 ec 0c             	sub    $0xc,%esp
  802173:	50                   	push   %eax
  802174:	e8 b0 f1 ff ff       	call   801329 <sys_ipc_recv>
  802179:	83 c4 10             	add    $0x10,%esp
  80217c:	85 c0                	test   %eax,%eax
  80217e:	78 3f                	js     8021bf <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  802180:	e8 92 ef ff ff       	call   801117 <sys_getenvid>
  802185:	25 ff 03 00 00       	and    $0x3ff,%eax
  80218a:	6b d0 7c             	imul   $0x7c,%eax,%edx
  80218d:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  802193:	89 15 b0 40 80 00    	mov    %edx,0x8040b0

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  802199:	85 f6                	test   %esi,%esi
  80219b:	74 05                	je     8021a2 <ipc_recv+0x4e>
  80219d:	8b 42 74             	mov    0x74(%edx),%eax
  8021a0:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  8021a2:	85 db                	test   %ebx,%ebx
  8021a4:	74 0a                	je     8021b0 <ipc_recv+0x5c>
  8021a6:	a1 b0 40 80 00       	mov    0x8040b0,%eax
  8021ab:	8b 40 78             	mov    0x78(%eax),%eax
  8021ae:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  8021b0:	a1 b0 40 80 00       	mov    0x8040b0,%eax
  8021b5:	8b 40 70             	mov    0x70(%eax),%eax
}
  8021b8:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8021bb:	5b                   	pop    %ebx
  8021bc:	5e                   	pop    %esi
  8021bd:	5d                   	pop    %ebp
  8021be:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  8021bf:	85 f6                	test   %esi,%esi
  8021c1:	74 06                	je     8021c9 <ipc_recv+0x75>
  8021c3:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  8021c9:	85 db                	test   %ebx,%ebx
  8021cb:	74 eb                	je     8021b8 <ipc_recv+0x64>
  8021cd:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8021d3:	eb e3                	jmp    8021b8 <ipc_recv+0x64>

008021d5 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  8021d5:	f3 0f 1e fb          	endbr32 
  8021d9:	55                   	push   %ebp
  8021da:	89 e5                	mov    %esp,%ebp
  8021dc:	57                   	push   %edi
  8021dd:	56                   	push   %esi
  8021de:	53                   	push   %ebx
  8021df:	83 ec 0c             	sub    $0xc,%esp
  8021e2:	8b 7d 08             	mov    0x8(%ebp),%edi
  8021e5:	8b 75 0c             	mov    0xc(%ebp),%esi
  8021e8:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  8021eb:	85 db                	test   %ebx,%ebx
  8021ed:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  8021f2:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  8021f5:	ff 75 14             	pushl  0x14(%ebp)
  8021f8:	53                   	push   %ebx
  8021f9:	56                   	push   %esi
  8021fa:	57                   	push   %edi
  8021fb:	e8 02 f1 ff ff       	call   801302 <sys_ipc_try_send>
  802200:	83 c4 10             	add    $0x10,%esp
  802203:	85 c0                	test   %eax,%eax
  802205:	79 1e                	jns    802225 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  802207:	83 f8 f9             	cmp    $0xfffffff9,%eax
  80220a:	75 07                	jne    802213 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  80220c:	e8 29 ef ff ff       	call   80113a <sys_yield>
  802211:	eb e2                	jmp    8021f5 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  802213:	50                   	push   %eax
  802214:	68 e6 2a 80 00       	push   $0x802ae6
  802219:	6a 3b                	push   $0x3b
  80221b:	68 fa 2a 80 00       	push   $0x802afa
  802220:	e8 36 e4 ff ff       	call   80065b <_panic>
	}
}
  802225:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802228:	5b                   	pop    %ebx
  802229:	5e                   	pop    %esi
  80222a:	5f                   	pop    %edi
  80222b:	5d                   	pop    %ebp
  80222c:	c3                   	ret    

0080222d <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  80222d:	f3 0f 1e fb          	endbr32 
  802231:	55                   	push   %ebp
  802232:	89 e5                	mov    %esp,%ebp
  802234:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  802237:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  80223c:	6b d0 7c             	imul   $0x7c,%eax,%edx
  80223f:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  802245:	8b 52 50             	mov    0x50(%edx),%edx
  802248:	39 ca                	cmp    %ecx,%edx
  80224a:	74 11                	je     80225d <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  80224c:	83 c0 01             	add    $0x1,%eax
  80224f:	3d 00 04 00 00       	cmp    $0x400,%eax
  802254:	75 e6                	jne    80223c <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  802256:	b8 00 00 00 00       	mov    $0x0,%eax
  80225b:	eb 0b                	jmp    802268 <ipc_find_env+0x3b>
			return envs[i].env_id;
  80225d:	6b c0 7c             	imul   $0x7c,%eax,%eax
  802260:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  802265:	8b 40 48             	mov    0x48(%eax),%eax
}
  802268:	5d                   	pop    %ebp
  802269:	c3                   	ret    

0080226a <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  80226a:	f3 0f 1e fb          	endbr32 
  80226e:	55                   	push   %ebp
  80226f:	89 e5                	mov    %esp,%ebp
  802271:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  802274:	89 c2                	mov    %eax,%edx
  802276:	c1 ea 16             	shr    $0x16,%edx
  802279:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  802280:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  802285:	f6 c1 01             	test   $0x1,%cl
  802288:	74 1c                	je     8022a6 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  80228a:	c1 e8 0c             	shr    $0xc,%eax
  80228d:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  802294:	a8 01                	test   $0x1,%al
  802296:	74 0e                	je     8022a6 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  802298:	c1 e8 0c             	shr    $0xc,%eax
  80229b:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8022a2:	ef 
  8022a3:	0f b7 d2             	movzwl %dx,%edx
}
  8022a6:	89 d0                	mov    %edx,%eax
  8022a8:	5d                   	pop    %ebp
  8022a9:	c3                   	ret    
  8022aa:	66 90                	xchg   %ax,%ax
  8022ac:	66 90                	xchg   %ax,%ax
  8022ae:	66 90                	xchg   %ax,%ax

008022b0 <__udivdi3>:
  8022b0:	f3 0f 1e fb          	endbr32 
  8022b4:	55                   	push   %ebp
  8022b5:	57                   	push   %edi
  8022b6:	56                   	push   %esi
  8022b7:	53                   	push   %ebx
  8022b8:	83 ec 1c             	sub    $0x1c,%esp
  8022bb:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  8022bf:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  8022c3:	8b 74 24 34          	mov    0x34(%esp),%esi
  8022c7:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  8022cb:	85 d2                	test   %edx,%edx
  8022cd:	75 19                	jne    8022e8 <__udivdi3+0x38>
  8022cf:	39 f3                	cmp    %esi,%ebx
  8022d1:	76 4d                	jbe    802320 <__udivdi3+0x70>
  8022d3:	31 ff                	xor    %edi,%edi
  8022d5:	89 e8                	mov    %ebp,%eax
  8022d7:	89 f2                	mov    %esi,%edx
  8022d9:	f7 f3                	div    %ebx
  8022db:	89 fa                	mov    %edi,%edx
  8022dd:	83 c4 1c             	add    $0x1c,%esp
  8022e0:	5b                   	pop    %ebx
  8022e1:	5e                   	pop    %esi
  8022e2:	5f                   	pop    %edi
  8022e3:	5d                   	pop    %ebp
  8022e4:	c3                   	ret    
  8022e5:	8d 76 00             	lea    0x0(%esi),%esi
  8022e8:	39 f2                	cmp    %esi,%edx
  8022ea:	76 14                	jbe    802300 <__udivdi3+0x50>
  8022ec:	31 ff                	xor    %edi,%edi
  8022ee:	31 c0                	xor    %eax,%eax
  8022f0:	89 fa                	mov    %edi,%edx
  8022f2:	83 c4 1c             	add    $0x1c,%esp
  8022f5:	5b                   	pop    %ebx
  8022f6:	5e                   	pop    %esi
  8022f7:	5f                   	pop    %edi
  8022f8:	5d                   	pop    %ebp
  8022f9:	c3                   	ret    
  8022fa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802300:	0f bd fa             	bsr    %edx,%edi
  802303:	83 f7 1f             	xor    $0x1f,%edi
  802306:	75 48                	jne    802350 <__udivdi3+0xa0>
  802308:	39 f2                	cmp    %esi,%edx
  80230a:	72 06                	jb     802312 <__udivdi3+0x62>
  80230c:	31 c0                	xor    %eax,%eax
  80230e:	39 eb                	cmp    %ebp,%ebx
  802310:	77 de                	ja     8022f0 <__udivdi3+0x40>
  802312:	b8 01 00 00 00       	mov    $0x1,%eax
  802317:	eb d7                	jmp    8022f0 <__udivdi3+0x40>
  802319:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802320:	89 d9                	mov    %ebx,%ecx
  802322:	85 db                	test   %ebx,%ebx
  802324:	75 0b                	jne    802331 <__udivdi3+0x81>
  802326:	b8 01 00 00 00       	mov    $0x1,%eax
  80232b:	31 d2                	xor    %edx,%edx
  80232d:	f7 f3                	div    %ebx
  80232f:	89 c1                	mov    %eax,%ecx
  802331:	31 d2                	xor    %edx,%edx
  802333:	89 f0                	mov    %esi,%eax
  802335:	f7 f1                	div    %ecx
  802337:	89 c6                	mov    %eax,%esi
  802339:	89 e8                	mov    %ebp,%eax
  80233b:	89 f7                	mov    %esi,%edi
  80233d:	f7 f1                	div    %ecx
  80233f:	89 fa                	mov    %edi,%edx
  802341:	83 c4 1c             	add    $0x1c,%esp
  802344:	5b                   	pop    %ebx
  802345:	5e                   	pop    %esi
  802346:	5f                   	pop    %edi
  802347:	5d                   	pop    %ebp
  802348:	c3                   	ret    
  802349:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802350:	89 f9                	mov    %edi,%ecx
  802352:	b8 20 00 00 00       	mov    $0x20,%eax
  802357:	29 f8                	sub    %edi,%eax
  802359:	d3 e2                	shl    %cl,%edx
  80235b:	89 54 24 08          	mov    %edx,0x8(%esp)
  80235f:	89 c1                	mov    %eax,%ecx
  802361:	89 da                	mov    %ebx,%edx
  802363:	d3 ea                	shr    %cl,%edx
  802365:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802369:	09 d1                	or     %edx,%ecx
  80236b:	89 f2                	mov    %esi,%edx
  80236d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802371:	89 f9                	mov    %edi,%ecx
  802373:	d3 e3                	shl    %cl,%ebx
  802375:	89 c1                	mov    %eax,%ecx
  802377:	d3 ea                	shr    %cl,%edx
  802379:	89 f9                	mov    %edi,%ecx
  80237b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  80237f:	89 eb                	mov    %ebp,%ebx
  802381:	d3 e6                	shl    %cl,%esi
  802383:	89 c1                	mov    %eax,%ecx
  802385:	d3 eb                	shr    %cl,%ebx
  802387:	09 de                	or     %ebx,%esi
  802389:	89 f0                	mov    %esi,%eax
  80238b:	f7 74 24 08          	divl   0x8(%esp)
  80238f:	89 d6                	mov    %edx,%esi
  802391:	89 c3                	mov    %eax,%ebx
  802393:	f7 64 24 0c          	mull   0xc(%esp)
  802397:	39 d6                	cmp    %edx,%esi
  802399:	72 15                	jb     8023b0 <__udivdi3+0x100>
  80239b:	89 f9                	mov    %edi,%ecx
  80239d:	d3 e5                	shl    %cl,%ebp
  80239f:	39 c5                	cmp    %eax,%ebp
  8023a1:	73 04                	jae    8023a7 <__udivdi3+0xf7>
  8023a3:	39 d6                	cmp    %edx,%esi
  8023a5:	74 09                	je     8023b0 <__udivdi3+0x100>
  8023a7:	89 d8                	mov    %ebx,%eax
  8023a9:	31 ff                	xor    %edi,%edi
  8023ab:	e9 40 ff ff ff       	jmp    8022f0 <__udivdi3+0x40>
  8023b0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8023b3:	31 ff                	xor    %edi,%edi
  8023b5:	e9 36 ff ff ff       	jmp    8022f0 <__udivdi3+0x40>
  8023ba:	66 90                	xchg   %ax,%ax
  8023bc:	66 90                	xchg   %ax,%ax
  8023be:	66 90                	xchg   %ax,%ax

008023c0 <__umoddi3>:
  8023c0:	f3 0f 1e fb          	endbr32 
  8023c4:	55                   	push   %ebp
  8023c5:	57                   	push   %edi
  8023c6:	56                   	push   %esi
  8023c7:	53                   	push   %ebx
  8023c8:	83 ec 1c             	sub    $0x1c,%esp
  8023cb:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  8023cf:	8b 74 24 30          	mov    0x30(%esp),%esi
  8023d3:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  8023d7:	8b 7c 24 38          	mov    0x38(%esp),%edi
  8023db:	85 c0                	test   %eax,%eax
  8023dd:	75 19                	jne    8023f8 <__umoddi3+0x38>
  8023df:	39 df                	cmp    %ebx,%edi
  8023e1:	76 5d                	jbe    802440 <__umoddi3+0x80>
  8023e3:	89 f0                	mov    %esi,%eax
  8023e5:	89 da                	mov    %ebx,%edx
  8023e7:	f7 f7                	div    %edi
  8023e9:	89 d0                	mov    %edx,%eax
  8023eb:	31 d2                	xor    %edx,%edx
  8023ed:	83 c4 1c             	add    $0x1c,%esp
  8023f0:	5b                   	pop    %ebx
  8023f1:	5e                   	pop    %esi
  8023f2:	5f                   	pop    %edi
  8023f3:	5d                   	pop    %ebp
  8023f4:	c3                   	ret    
  8023f5:	8d 76 00             	lea    0x0(%esi),%esi
  8023f8:	89 f2                	mov    %esi,%edx
  8023fa:	39 d8                	cmp    %ebx,%eax
  8023fc:	76 12                	jbe    802410 <__umoddi3+0x50>
  8023fe:	89 f0                	mov    %esi,%eax
  802400:	89 da                	mov    %ebx,%edx
  802402:	83 c4 1c             	add    $0x1c,%esp
  802405:	5b                   	pop    %ebx
  802406:	5e                   	pop    %esi
  802407:	5f                   	pop    %edi
  802408:	5d                   	pop    %ebp
  802409:	c3                   	ret    
  80240a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802410:	0f bd e8             	bsr    %eax,%ebp
  802413:	83 f5 1f             	xor    $0x1f,%ebp
  802416:	75 50                	jne    802468 <__umoddi3+0xa8>
  802418:	39 d8                	cmp    %ebx,%eax
  80241a:	0f 82 e0 00 00 00    	jb     802500 <__umoddi3+0x140>
  802420:	89 d9                	mov    %ebx,%ecx
  802422:	39 f7                	cmp    %esi,%edi
  802424:	0f 86 d6 00 00 00    	jbe    802500 <__umoddi3+0x140>
  80242a:	89 d0                	mov    %edx,%eax
  80242c:	89 ca                	mov    %ecx,%edx
  80242e:	83 c4 1c             	add    $0x1c,%esp
  802431:	5b                   	pop    %ebx
  802432:	5e                   	pop    %esi
  802433:	5f                   	pop    %edi
  802434:	5d                   	pop    %ebp
  802435:	c3                   	ret    
  802436:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80243d:	8d 76 00             	lea    0x0(%esi),%esi
  802440:	89 fd                	mov    %edi,%ebp
  802442:	85 ff                	test   %edi,%edi
  802444:	75 0b                	jne    802451 <__umoddi3+0x91>
  802446:	b8 01 00 00 00       	mov    $0x1,%eax
  80244b:	31 d2                	xor    %edx,%edx
  80244d:	f7 f7                	div    %edi
  80244f:	89 c5                	mov    %eax,%ebp
  802451:	89 d8                	mov    %ebx,%eax
  802453:	31 d2                	xor    %edx,%edx
  802455:	f7 f5                	div    %ebp
  802457:	89 f0                	mov    %esi,%eax
  802459:	f7 f5                	div    %ebp
  80245b:	89 d0                	mov    %edx,%eax
  80245d:	31 d2                	xor    %edx,%edx
  80245f:	eb 8c                	jmp    8023ed <__umoddi3+0x2d>
  802461:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802468:	89 e9                	mov    %ebp,%ecx
  80246a:	ba 20 00 00 00       	mov    $0x20,%edx
  80246f:	29 ea                	sub    %ebp,%edx
  802471:	d3 e0                	shl    %cl,%eax
  802473:	89 44 24 08          	mov    %eax,0x8(%esp)
  802477:	89 d1                	mov    %edx,%ecx
  802479:	89 f8                	mov    %edi,%eax
  80247b:	d3 e8                	shr    %cl,%eax
  80247d:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802481:	89 54 24 04          	mov    %edx,0x4(%esp)
  802485:	8b 54 24 04          	mov    0x4(%esp),%edx
  802489:	09 c1                	or     %eax,%ecx
  80248b:	89 d8                	mov    %ebx,%eax
  80248d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802491:	89 e9                	mov    %ebp,%ecx
  802493:	d3 e7                	shl    %cl,%edi
  802495:	89 d1                	mov    %edx,%ecx
  802497:	d3 e8                	shr    %cl,%eax
  802499:	89 e9                	mov    %ebp,%ecx
  80249b:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  80249f:	d3 e3                	shl    %cl,%ebx
  8024a1:	89 c7                	mov    %eax,%edi
  8024a3:	89 d1                	mov    %edx,%ecx
  8024a5:	89 f0                	mov    %esi,%eax
  8024a7:	d3 e8                	shr    %cl,%eax
  8024a9:	89 e9                	mov    %ebp,%ecx
  8024ab:	89 fa                	mov    %edi,%edx
  8024ad:	d3 e6                	shl    %cl,%esi
  8024af:	09 d8                	or     %ebx,%eax
  8024b1:	f7 74 24 08          	divl   0x8(%esp)
  8024b5:	89 d1                	mov    %edx,%ecx
  8024b7:	89 f3                	mov    %esi,%ebx
  8024b9:	f7 64 24 0c          	mull   0xc(%esp)
  8024bd:	89 c6                	mov    %eax,%esi
  8024bf:	89 d7                	mov    %edx,%edi
  8024c1:	39 d1                	cmp    %edx,%ecx
  8024c3:	72 06                	jb     8024cb <__umoddi3+0x10b>
  8024c5:	75 10                	jne    8024d7 <__umoddi3+0x117>
  8024c7:	39 c3                	cmp    %eax,%ebx
  8024c9:	73 0c                	jae    8024d7 <__umoddi3+0x117>
  8024cb:	2b 44 24 0c          	sub    0xc(%esp),%eax
  8024cf:	1b 54 24 08          	sbb    0x8(%esp),%edx
  8024d3:	89 d7                	mov    %edx,%edi
  8024d5:	89 c6                	mov    %eax,%esi
  8024d7:	89 ca                	mov    %ecx,%edx
  8024d9:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  8024de:	29 f3                	sub    %esi,%ebx
  8024e0:	19 fa                	sbb    %edi,%edx
  8024e2:	89 d0                	mov    %edx,%eax
  8024e4:	d3 e0                	shl    %cl,%eax
  8024e6:	89 e9                	mov    %ebp,%ecx
  8024e8:	d3 eb                	shr    %cl,%ebx
  8024ea:	d3 ea                	shr    %cl,%edx
  8024ec:	09 d8                	or     %ebx,%eax
  8024ee:	83 c4 1c             	add    $0x1c,%esp
  8024f1:	5b                   	pop    %ebx
  8024f2:	5e                   	pop    %esi
  8024f3:	5f                   	pop    %edi
  8024f4:	5d                   	pop    %ebp
  8024f5:	c3                   	ret    
  8024f6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8024fd:	8d 76 00             	lea    0x0(%esi),%esi
  802500:	29 fe                	sub    %edi,%esi
  802502:	19 c3                	sbb    %eax,%ebx
  802504:	89 f2                	mov    %esi,%edx
  802506:	89 d9                	mov    %ebx,%ecx
  802508:	e9 1d ff ff ff       	jmp    80242a <__umoddi3+0x6a>
